Version: 0.1
Aplikasi manajemen sekolah berbasis NestJS (backend) dan Next.js (frontend).
- Framework: NestJS (Node.js, TypeScript)
- ORM: TypeORM
- Database: MySQL
- Authentication: JWT (Passport)
- Validation: class-validator, class-transformer
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- UI Library: React 18
- Styling: Tailwind CSS
- State Management: Zustand
- API Client: Axios
- Data Fetching: React Query (TanStack Query)
- Node.js 18+
- MySQL 8.0+
- npm atau yarn
git clone <repository-url>
cd class# Backend dependencies
npm install
# Frontend dependencies
cd frontend
npm installBuat file .env di root directory:
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=
DB_DATABASE=class
JWT_SECRET=your-secret-key-change-this-in-production
JWT_EXPIRES_IN=24h
NODE_ENV=developmentBuat file frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:3000/apiPastikan database MySQL sudah dibuat dan dikonfigurasi. TypeORM akan auto-sync entities jika NODE_ENV=development.
Terminal 1 - Backend (NestJS):
npm run start:devBackend akan berjalan di http://localhost:3000
Terminal 2 - Frontend (Next.js):
cd frontend
npm run devFrontend akan berjalan di http://localhost:3001 (atau port yang ditentukan Next.js)
Build Backend:
npm run build
npm run start:prodBuild Frontend:
cd frontend
npm run build
npm run startclass/
βββ src/ # NestJS backend source
β βββ modules/ # Feature modules
β β βββ auth/ # Authentication
β β βββ admin/ # Super admin
β β βββ users/ # User management
β β βββ students/ # Student management
β β βββ teachers/ # Teacher management
β β βββ ... # Other modules
β βββ common/ # Shared utilities
β β βββ decorators/ # Custom decorators
β β βββ guards/ # Auth guards
β β βββ middleware/ # Custom middleware
β βββ main.ts # Application entry point
βββ frontend/ # Next.js frontend
β βββ app/ # Next.js App Router
β β βββ admin/ # Admin pages
β β βββ [tenant]/ # Tenant pages
β β βββ login/ # Auth pages
β βββ components/ # React components
β βββ lib/ # Utilities
β β βββ api/ # API client
β β βββ store/ # State management
β βββ public/ # Static files
βββ database/ # Database files
β βββ sql/ # SQL migration scripts
β βββ database.sqlite # SQLite database (optional)
βββ storage/ # File storage
βββ app/ # Uploaded files
Aplikasi menggunakan JWT authentication. Setelah login, token akan disimpan dan digunakan untuk semua API requests.
POST /api/auth/login
Content-Type: application/json
{
"email": "admin@example.com",
"password": "password"
}Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"email": "admin@example.com",
"role": "super_admin",
"instansiId": 1
}
}GET /api/users
Authorization: Bearer YOUR_TOKENGET /api/admin/dashboard- Dashboard statisticsGET /api/admin/tenants- List all tenantsPOST /api/admin/tenants- Create tenantGET /api/admin/tenants/:id- Get tenant detailsPUT /api/admin/tenants/:id- Update tenantPOST /api/admin/tenants/:id/activate- Activate tenantPOST /api/admin/tenants/:id/deactivate- Deactivate tenantDELETE /api/admin/tenants/:id- Delete tenantGET /api/admin/users- List all usersGET /api/admin/users/:id- Get user detailsPOST /api/admin/users/:id/activate- Activate userPOST /api/admin/users/:id/deactivate- Deactivate user
GET /api/public/home- Home statisticsGET /api/public/news- List newsGET /api/public/news/featured- Featured newsGET /api/public/news/latest- Latest newsGET /api/public/news/:slug- Get news by slugGET /api/public/galleries- List galleriesGET /api/public/galleries/:id- Get gallery by idGET /api/public/menus- Get active menusGET /api/public/profile- Get tenant profile
Semua modul lain memiliki endpoints standar:
GET /api/{module}- List itemsGET /api/{module}/:id- Get item detailsPOST /api/{module}- Create itemPUT /api/{module}/:id- Update itemDELETE /api/{module}/:id- Delete item
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covnpm run build- Build for productionnpm run start- Start production servernpm run start:dev- Start development server with watch modenpm run start:debug- Start with debug modenpm run lint- Lint codenpm run format- Format code
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Lint code
- JWT tokens dengan expiration
- Password hashing dengan bcrypt
- Role-based access control (RBAC)
- Input validation dengan class-validator
- SQL injection protection dengan TypeORM
TEKNOLOGI_STACK.md- Detail stack teknologiMIGRASI_FRONTEND.md- Panduan migrasi frontendMIGRASI_SELESAI.md- Dokumentasi sejarah migrasi
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
Untuk bantuan dan pertanyaan, silakan buat issue di repository ini.
Note: Aplikasi ini menggunakan stack modern NestJS (backend) dan Next.js (frontend). Semua fitur inti sudah tersedia dan siap digunakan.