A modern web application built with Next.js that enables seamless communication between parents and teachers through chat, appointments, and notices.
Try the app with pre-seeded demo data:
npm install
npx prisma migrate dev
npx prisma db seed
npm run devDemo Login Credentials:
- Teacher:
john.smith@school.com/password123 - Parent:
mike.brown@email.com/password123
See DEMO_ACCOUNTS.md for all demo accounts and CHAT_TEST.md for testing real-time chat.
- Real-time Chat: Socket.io powered instant messaging between parents and teachers
- Appointment Scheduling: Parents can request appointments, teachers can confirm or cancel
- Notices & Complaints: Teachers can send notices or complaints to parents about specific children
- Invite Code System: Teachers generate secure invite codes for parents to connect
- Email/password authentication using NextAuth.js
- Role-based access control (Parent/Teacher)
- Protected routes with middleware
- Role-specific dashboards for Parents and Teachers
- Responsive design that works on mobile and desktop
- Clean, modern UI built with shadcn/ui components
- Framework: Next.js 15 (App Router)
- Database: SQLite with Prisma ORM
- Authentication: NextAuth.js
- Real-time: Socket.io
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Language: TypeScript
- Node.js 18+ installed
- npm or yarn package manager
- Clone the repository:
git clone <repository-url>
cd PTCA- Install dependencies:
npm install- Set up environment variables:
Create a
.envfile in the root directory:
DATABASE_URL="file:./dev.db"
NEXTAUTH_SECRET="your-secret-key-change-this-in-production"
NEXTAUTH_URL="http://localhost:3000"
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
- Initialize the database:
npx prisma migrate dev- (Optional) Seed the database with demo data:
npx prisma db seed- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
- Sign up with your email and select "Teacher" as your role
- Generate invite codes from the "Invite Codes" page
- Share the codes with parents
- Once connected, you can:
- Chat with parents in real-time
- Manage appointment requests
- Send notices or complaints
- Sign up with your email and select "Parent" as your role
- Get an invite code from your child's teacher
- Enter the code and your child's name on the "Connect" page
- Once connected, you can:
- Chat with teachers
- Request appointments
- View notices and complaints
├── app/ # Next.js App Router pages
│ ├── (auth)/ # Authentication pages
│ ├── api/ # API routes
│ ├── appointments/ # Appointment scheduling
│ ├── chat/ # Real-time chat
│ ├── connect/ # Parent connection page
│ ├── dashboard/ # Main dashboard
│ ├── invite-codes/ # Teacher invite codes
│ └── notices/ # Notices & complaints
├── components/ # React components
│ ├── dashboard/ # Dashboard layouts
│ └── ui/ # shadcn/ui components
├── lib/ # Utility functions
│ ├── auth.ts # NextAuth configuration
│ ├── prisma.ts # Prisma client
│ ├── socket.ts # Socket.io client hook
│ └── types.ts # Type definitions
├── pages/api/socket/ # Socket.io server
├── prisma/ # Database schema
└── types/ # TypeScript type definitions
The application uses the following main models:
- User: Stores user accounts (parents and teachers)
- Connection: Links parents and teachers for a specific child
- InviteCode: Temporary codes for establishing connections
- Message: Chat messages between connected users
- Appointment: Scheduled meetings
- Notice: Notices and complaints from teachers to parents
npm run buildnpm start# Generate Prisma Client
npx prisma generate
# Create a new migration
npx prisma migrate dev --name <migration-name>
# Open Prisma Studio (database GUI)
npx prisma studionpx prisma db seedThis will create demo accounts for testing. See DEMO_ACCOUNTS.md for login credentials.
- Passwords are hashed using bcryptjs
- JWT-based session management
- Protected API routes
- Input validation using Zod
- Role-based access control
MIT
For issues or questions, please open an issue on the repository.