- Aldi Pramudya - G6401231003 - Backend
- Muhammad Fauzan Akbar - G6401231045 - Backend
- Cokorda Gd. Satria Widnyana Putra - G6401231064 - Frontend
- Johanna Davina Habeahan - G6401231087 - UX/UI
- Ghanianda Wafiqarifah - G6401231126 - Frontend
A Node.js-based application for managing students authentication, registration, and role-based access control using Express, Prisma, and JWT.
- Authentication: Secure login with JWT-based authentication.
- Role-Based Access Control: Admin, teacher (
guru), and student (siswa) roles. - Validation: Input validation using Joi.
- Rate Limiting: Protects against abuse with request rate limiting.
- Security: Implements security best practices with Helmet and CORS.
- Database: PostgreSQL integration with Prisma ORM.
- Node.js (v16+)
- PostgreSQL
- npm (v7+)
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory and configure the following:DATABASE_URL=your_database_url JWT_TOKEN_SECRET=your_jwt_secret SECRET_KEY_SESSION=your_cookie_secret CORS_ORIGIN=http://localhost:3000
-
Run database migrations:
npx prisma migrate dev
Start the development server:
npm run devBuild and start the application:
npm run build
npm start- POST
/api/auth/login: User login. - POST
/api/admin/register: Admin registration (requires admin privileges).
- Use the
Authorization: Bearer <token>header for accessing protected routes.
src/
├── app.js # Main application file
├── routes/ # API route definitions
├── controllers/ # Route handlers
├── middleware/ # Custom middleware (e.g., auth, rate limiter)
├── validators/ # Input validation schemas
├── strategies/ # Passport strategies
├── utils/ # Utility functions
└── prisma/ # Prisma schema and migrations
- Backend: Node.js, Express
- Database: PostgreSQL, Prisma
- Authentication: JWT, Passport.js
- Validation: Joi
- Security: Helmet, CORS
- Rate Limiting:
express-rate-limit
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name" - Push to the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.