Skip to content

kangjhooe/class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CLASS - School Management System

Version: 0.1

Aplikasi manajemen sekolah berbasis NestJS (backend) dan Next.js (frontend).

πŸš€ Tech Stack

Backend

  • Framework: NestJS (Node.js, TypeScript)
  • ORM: TypeORM
  • Database: MySQL
  • Authentication: JWT (Passport)
  • Validation: class-validator, class-transformer

Frontend

  • 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)

πŸ“‹ Prerequisites

  • Node.js 18+
  • MySQL 8.0+
  • npm atau yarn

πŸ› οΈ Installation

1. Clone Repository

git clone <repository-url>
cd class

2. Install Dependencies

# Backend dependencies
npm install

# Frontend dependencies
cd frontend
npm install

3. Setup Environment

Buat 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=development

Buat file frontend/.env.local:

NEXT_PUBLIC_API_URL=http://localhost:3000/api

4. Database Setup

Pastikan database MySQL sudah dibuat dan dikonfigurasi. TypeORM akan auto-sync entities jika NODE_ENV=development.

πŸš€ Running the Application

Development Mode

Terminal 1 - Backend (NestJS):

npm run start:dev

Backend akan berjalan di http://localhost:3000

Terminal 2 - Frontend (Next.js):

cd frontend
npm run dev

Frontend akan berjalan di http://localhost:3001 (atau port yang ditentukan Next.js)

Production Mode

Build Backend:

npm run build
npm run start:prod

Build Frontend:

cd frontend
npm run build
npm run start

πŸ“ Project Structure

class/
β”œβ”€β”€ 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

πŸ” Authentication

Aplikasi menggunakan JWT authentication. Setelah login, token akan disimpan dan digunakan untuk semua API requests.

Login

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
  }
}

Using Token

GET /api/users
Authorization: Bearer YOUR_TOKEN

πŸ“š API Documentation

Admin Endpoints (Super Admin Only)

  • GET /api/admin/dashboard - Dashboard statistics
  • GET /api/admin/tenants - List all tenants
  • POST /api/admin/tenants - Create tenant
  • GET /api/admin/tenants/:id - Get tenant details
  • PUT /api/admin/tenants/:id - Update tenant
  • POST /api/admin/tenants/:id/activate - Activate tenant
  • POST /api/admin/tenants/:id/deactivate - Deactivate tenant
  • DELETE /api/admin/tenants/:id - Delete tenant
  • GET /api/admin/users - List all users
  • GET /api/admin/users/:id - Get user details
  • POST /api/admin/users/:id/activate - Activate user
  • POST /api/admin/users/:id/deactivate - Deactivate user

Public Page Endpoints

  • GET /api/public/home - Home statistics
  • GET /api/public/news - List news
  • GET /api/public/news/featured - Featured news
  • GET /api/public/news/latest - Latest news
  • GET /api/public/news/:slug - Get news by slug
  • GET /api/public/galleries - List galleries
  • GET /api/public/galleries/:id - Get gallery by id
  • GET /api/public/menus - Get active menus
  • GET /api/public/profile - Get tenant profile

Other Modules

Semua modul lain memiliki endpoints standar:

  • GET /api/{module} - List items
  • GET /api/{module}/:id - Get item details
  • POST /api/{module} - Create item
  • PUT /api/{module}/:id - Update item
  • DELETE /api/{module}/:id - Delete item

πŸ§ͺ Testing

# Unit tests
npm run test

# E2E tests
npm run test:e2e

# Test coverage
npm run test:cov

πŸ“ Available Scripts

Backend

  • npm run build - Build for production
  • npm run start - Start production server
  • npm run start:dev - Start development server with watch mode
  • npm run start:debug - Start with debug mode
  • npm run lint - Lint code
  • npm run format - Format code

Frontend

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Lint code

πŸ”’ Security

  • JWT tokens dengan expiration
  • Password hashing dengan bcrypt
  • Role-based access control (RBAC)
  • Input validation dengan class-validator
  • SQL injection protection dengan TypeORM

πŸ“– Documentation

  • TEKNOLOGI_STACK.md - Detail stack teknologi
  • MIGRASI_FRONTEND.md - Panduan migrasi frontend
  • MIGRASI_SELESAI.md - Dokumentasi sejarah migrasi

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

πŸ†˜ Support

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors