Create a full-stack Next.js application using the App Router (app/ directory). The application will be a web platform named 'Survivor Aid' (Vefat Yardımı) designed to help young adults navigate survivor benefits applications.
**Core Functionality:**
1. **User Authentication:** Implement secure user registration and login using Clerk or NextAuth.js.
2. **Profile Management:** Allow users to create and manage profiles, including personal details, deceased parent's information (date of death, age at death), and relationship to the deceased.
3. **Eligibility Checker:** Develop a feature that takes user inputs and checks preliminary eligibility for survivor benefits based on common criteria (e.g., age, relationship, remarriage status of the deceased parent). This should be a multi-step form within the app.
4. **Application Guidance:** Provide step-by-step guides for the application process, including links to official resources and forms. This guidance should be dynamic based on the eligibility check results.
5. **Document Checklist:** A feature to help users track required documents for their specific situation. Users should be able to mark documents as 'obtained'.
6. **Resource Directory:** A curated list of official government websites and contact information for relevant agencies (e.g., Social Security Administration in the US, or equivalent local agency). Potentially include a directory of vetted legal professionals specializing in benefits law.
7. **Dashboard:** A central dashboard for logged-in users to see their profile summary, eligibility status, outstanding tasks, and saved resources.
**Technical Stack:**
* **Frontend:** Next.js App Router (app/ directory), React, Tailwind CSS for styling.
* **Database:** PostgreSQL with Drizzle ORM for schema definition and querying. Define clear schemas for `users`, `profiles`, `benefit_applications`, `documents`, and `resources`.
* **API Routes:** Implement API routes (`app/api/...`) for all CRUD operations.
* **Backend Logic:** Full CRUD (Create, Read, Update, Delete) operations for all managed data.
* **Deployment:** Assume deployment on Vercel.
**Database Schema (Drizzle):**
```typescript
// Example schema definitions - adapt as needed
import { pgTable, serial, text, timestamp, boolean, integer, varchar, uuid, foreignKey } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';
export const users = pgTable('users', {
id: uuid('id').primaryKey(),
// clerkId or nextAuthId, etc.
email: varchar('email', { length: 256 }).notNull().unique(),
createdAt: timestamp('created_at').defaultNow(),
});
export const userRelations = relations(users, ({ many }) => ({}));
export const profiles = pgTable('profiles', {
id: serial('id').primaryKey(),
userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }),
firstName: varchar('first_name', { length: 100 }),
lastName: varchar('last_name', { length: 100 }),
dateOfBirth: timestamp('date_of_birth'), // User's DOB
deceasedParentDOB: timestamp('deceased_parent_dob'),
deceasedParentDateOfDeath: timestamp('deceased_parent_date_of_death').notNull(),
deceasedParentAgeAtDeath: integer('deceased_parent_age_at_death'),
isParentRemarried: boolean('is_parent_remarried').default(false),
relationshipToDeceased: varchar('relationship_to_deceased', { length: 100 }),
// ... other relevant profile fields
});
export const profileRelations = relations(profiles, ({ one, many }) => ({
user: one(users, { fields: [profiles.userId], relations: [users.profiles] }),
benefitApplications: many(benefitApplications),
}));
export const benefitApplications = pgTable('benefit_applications', {
id: serial('id').primaryKey(),
profileId: integer('profile_id').notNull().references(() => profiles.id, { onDelete: 'cascade' }),
applicationType: varchar('application_type', { length: 255 }).notNull(), // e.g., 'Survivor Benefit'
applicationDate: timestamp('application_date'),
status: varchar('status', { length: 100 }).default('Not Started'), // e.g., 'Not Started', 'In Progress', 'Submitted', 'Approved', 'Denied'
applicationReferenceNumber: varchar('application_reference_number', { length: 255 }),
submittedDate: timestamp('submitted_date'),
});
export const benefitApplicationRelations = relations(benefitApplications, ({ one, many }) => ({
profile: one(profiles, { fields: [benefitApplications.profileId], relations: [profiles.benefitApplications] }),
documents: many(documents),
}));
export const documents = pgTable('documents', {
id: serial('id').primaryKey(),
benefitApplicationId: integer('benefit_application_id').notNull().references(() => benefitApplications.id, { onDelete: 'cascade' }),
documentName: varchar('document_name', { length: 255 }).notNull(),
isObtained: boolean('is_obtained').default(false),
uploadUrl: varchar('upload_url', { length: 1024 }), // For potential future file uploads
});
export const documentRelations = relations(documents, ({ one }) => ({
benefitApplication: one(benefitApplications, { fields: [documents.benefitApplicationId], relations: [benefitApplications.documents] }),
}));
export const resources = pgTable('resources', {
id: serial('id').primaryKey(),
title: varchar('title', { length: 255 }).notNull(),
description: text('description'),
url: varchar('url', { length: 1024 }).notNull(),
resourceType: varchar('resource_type', { length: 100 }), // e.g., 'Government Agency', 'Legal Aid', 'Form'
});
export const resourceRelations = relations(resources, ({ many }) => ({}));
```
**App Router Structure:**
```
app/
├── api/
│ ├── [resourceId]/route.ts
│ ├── applications/
│ │ ├── [applicationId]/route.ts
│ │ └── route.ts
│ ├── auth/
│ │ └── [...nextauth]/route.ts // If using NextAuth.js
│ ├── clerk/
│ │ └── route.ts // If using Clerk webhooks
│ ├── documents/
│ │ ├── [documentId]/route.ts
│ │ └── route.ts
│ ├── profiles/
│ │ ├── [profileId]/route.ts
│ │