school-registration-system

Online School Registration System

A comprehensive full-stack web application for managing school registrations with payment processing, document uploads, and role-based dashboards.

πŸš€ Features

Public Features

Student Dashboard

Admin Dashboard

Payment System

πŸ› οΈ Tech Stack

Backend

Frontend

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

You’ll also need accounts for:

πŸ”§ Installation

1. Clone the Repository

cd /Users/angelmerpioquinto/Desktop/School/school-registration-system

2. Backend Setup

# Install backend dependencies
npm install

# Copy environment variables
cp .env.example .env

# Edit .env with your credentials
# DATABASE_URL, JWT_SECRET, CLOUDINARY_*, STRIPE_*, EMAIL_*

# Generate Prisma client
npm run prisma:generate

# Run database migrations
npm run prisma:migrate

# Start backend server
npm run dev

The backend will run on http://localhost:5000

3. Frontend Setup

# Navigate to frontend directory
cd frontend

# Install frontend dependencies
npm install

# Copy environment variables
cp .env.local.example .env.local

# Edit .env.local with your API URL and Stripe key
# NEXT_PUBLIC_API_URL=http://localhost:5000/api
# NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key

# Start frontend development server
npm run dev

The frontend will run on http://localhost:3000

πŸ”‘ Environment Variables

Backend (.env)

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/school_registration"

# JWT
JWT_SECRET="your-super-secret-jwt-key"
JWT_EXPIRES_IN="7d"

# Cloudinary
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"

# Stripe
STRIPE_SECRET_KEY="sk_test_your-stripe-secret-key"

# Email
EMAIL_HOST="smtp.gmail.com"
EMAIL_PORT=587
EMAIL_USER="your-email@gmail.com"
EMAIL_PASSWORD="your-app-password"
EMAIL_FROM="School Registration <noreply@school.com>"

# Server
PORT=5000
FRONTEND_URL="http://localhost:3000"

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:5000/api
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your-stripe-publishable-key

πŸ“Š Database Schema

The application uses the following main tables:

🎯 Usage

Creating an Admin Account

Since registration creates student accounts by default, you’ll need to manually create an admin account in the database:

# Access Prisma Studio
npm run prisma:studio

# Or use SQL
psql -d school_registration
INSERT INTO users (id, email, password_hash, role) VALUES
  (gen_random_uuid(), 'admin@school.com', '$2b$10$...', 'ADMIN');

Note: Hash the password using bcrypt before inserting.

Student Registration Flow

  1. Visit the landing page
  2. Click β€œRegister Now”
  3. Fill out the multi-step registration form
  4. Login with your credentials
  5. Upload required documents
  6. Make payment
  7. Wait for admin approval

Admin Workflow

  1. Login with admin credentials
  2. View dashboard statistics
  3. Review pending registrations
  4. Check uploaded documents
  5. Approve or reject registrations
  6. Monitor payments

πŸ“ Project Structure

school-registration-system/
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma          # Database schema
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ auth.js                # Authentication routes
β”‚   β”œβ”€β”€ students.js            # Student management
β”‚   β”œβ”€β”€ documents.js           # File uploads
β”‚   └── payments.js            # Payment processing
β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ auth.js                # JWT authentication
β”‚   └── upload.js              # File upload config
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ cloudinary.js          # File storage
β”‚   β”œβ”€β”€ email.js               # Email notifications
β”‚   └── pdf.js                 # Receipt generation
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ page.tsx           # Landing page
β”‚   β”‚   β”œβ”€β”€ login/             # Login page
β”‚   β”‚   β”œβ”€β”€ register/          # Registration
β”‚   β”‚   β”œβ”€β”€ student/           # Student dashboard
β”‚   β”‚   └── admin/             # Admin dashboard
β”‚   β”œβ”€β”€ components/            # Reusable components
β”‚   β”œβ”€β”€ context/               # Auth context
β”‚   └── lib/                   # API client
└── server.js                  # Express server

🚒 Deployment

See DEPLOYMENT.md for detailed deployment instructions for:

πŸ”’ Security Features

πŸ“§ Email Notifications

The system sends automated emails for:

πŸ’³ Payment Integration

Stripe is integrated for:

πŸ› Troubleshooting

Database Connection Issues

# Check PostgreSQL is running
pg_isready

# Verify DATABASE_URL in .env

Prisma Issues

# Reset database
npm run prisma:migrate reset

# Regenerate client
npm run prisma:generate

File Upload Issues

πŸ“ API Documentation

Authentication

Students

Documents

Payments

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

πŸ“„ License

MIT License - feel free to use this project for your school or organization.

πŸ‘₯ Support

For issues or questions:

πŸŽ“ Credits

Built with modern web technologies for educational institutions.