Change Audiens
This commit is contained in:
124
README.md
124
README.md
@@ -1,36 +1,118 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# Portal Data Informatika (PODIF)
|
||||
|
||||
## Getting Started
|
||||
Sistem Informasi Data Mahasiswa Jurusan Informatika dengan autentikasi admin dan dosen.
|
||||
|
||||
First, run the development server:
|
||||
## Struktur Aplikasi
|
||||
|
||||
### Landing Page (Root)
|
||||
|
||||
- **URL**: `/`
|
||||
- **Fitur**: Halaman landing dengan modal login/register
|
||||
- **Layout**: Tanpa sidebar/navbar (clean auth interface)
|
||||
- **Komponen**:
|
||||
- Modal Login (Admin & Dosen)
|
||||
- Modal Register (Dosen/Kajur)
|
||||
|
||||
### Dashboard
|
||||
|
||||
- **URL**: `/dashboard`
|
||||
- **Fitur**: Dashboard utama dengan sidebar dan navbar
|
||||
- **Layout**: Menggunakan ClientLayout dengan sidebar/navbar
|
||||
- **Komponen**:
|
||||
- Statistik mahasiswa
|
||||
- Grafik dan chart
|
||||
- Menu navigasi
|
||||
|
||||
### Halaman Mahasiswa
|
||||
|
||||
- **URL**: `/dashboard/mahasiswa/*`
|
||||
- **Fitur**: Halaman data mahasiswa
|
||||
- **Layout**: Menggunakan ClientLayout dengan sidebar/navbar
|
||||
|
||||
## Autentikasi
|
||||
|
||||
### Role User
|
||||
|
||||
1. **Admin**
|
||||
|
||||
- Login dengan username dan password
|
||||
- Akses penuh ke semua fitur
|
||||
|
||||
2. **Dosen**
|
||||
|
||||
- Login dengan NIP dan password
|
||||
- Akses terbatas sesuai role
|
||||
|
||||
3. **Ketua Jurusan (Kajur)**
|
||||
- Login dengan NIP dan password
|
||||
- Akses khusus untuk kajur
|
||||
|
||||
### API Endpoints
|
||||
|
||||
- `POST /api/auth/login` - Login admin/dosen
|
||||
- `POST /api/auth/register` - Register dosen/kajur
|
||||
- `POST /api/auth/logout` - Logout
|
||||
- `GET /api/auth/check` - Cek status autentikasi
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Setup Environment Variables
|
||||
|
||||
Buat file `.env.local`:
|
||||
|
||||
```env
|
||||
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
|
||||
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
|
||||
JWT_SECRET=your_jwt_secret
|
||||
```
|
||||
|
||||
### 3. Setup Database
|
||||
|
||||
Jalankan script setup database:
|
||||
|
||||
```bash
|
||||
node setup_database.js
|
||||
```
|
||||
|
||||
### 4. Run Development Server
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
## Database Schema
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
### Tabel user_app
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
```sql
|
||||
CREATE TABLE user_app (
|
||||
id_user SERIAL PRIMARY KEY,
|
||||
username VARCHAR(50), -- hanya digunakan oleh admin
|
||||
nip VARCHAR(20), -- hanya digunakan oleh dosen & kajur
|
||||
password TEXT NOT NULL,
|
||||
role_user role_enum NOT NULL, -- ENUM: 'admin', 'dosen', 'kajur'
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
```
|
||||
|
||||
## Learn More
|
||||
## Middleware
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
Middleware mengatur:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
- Redirect user yang sudah login dari `/` ke `/dashboard`
|
||||
- Protect route `/dashboard/*` (harus login)
|
||||
- Clear invalid token dan redirect ke home
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
## Struktur File
|
||||
|
||||
## Deploy on Vercel
|
||||
```
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user