Skip to content
iamdayyPublic

About

Platform manajemen organisasi mahasiswa terpadu yang dibangun dengan arsitektur monorepo modern. Sistem ini dirancang untuk mendigitalisasi seluruh ekosistem kegiatan organisasi, mulai dari manajemen keanggotaan, administrasi dokumen otomatis, hingga sistem keterlibatan anggota (gamification).

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Himatika - Student Association Platform

A comprehensive web application built with Nuxt 4 for managing the Himatika student association. This platform includes features for event management, news distribution, member profiles, and administrative tools.

πŸš€ Features

  • Public Portal:
    • Homepage & News: SWR (Stale-While-Revalidate) caching for high performance.
    • Agendas/Events: Browse upcoming events and activities.
  • User Dashboard (SPA):
    • Profile Management: Manage personal data, academic info, and documents.
    • Authentication: Secure login/register with session management.
  • Administration:
    • CMS: Manage news, agendas, and users.
    • Committee Tools: Generate tickets, manage participants.
  • Advanced Features:
    • PDF Generation: Auto-generate tickets and documents.
    • QR Codes: For event attendance and ticketing.
    • Payments: Integrated with Midtrans.
    • Media: Image uploads (S3/R2) and video playback.
    • Localization: Support for ID (default) and EN.

πŸ›  Tech Stack

  • Framework: Nuxt 4
  • Language: TypeScript
  • Database: MongoDB (via Mongoose)
  • UI Framework: Nuxt UI (Tailwind CSS)
  • State Management: Pinia
  • Authentication: @sidebase/nuxt-auth
  • File Storage: AWS S3 / Cloudflare R2 (PDF documents via the separate himatika-pdf-worker service)
  • Utilities:
    • nuxt-i18n-micro for internationalization
    • zod for request validation

πŸ“¦ Setup & Installation

  1. Clone the repository:

    git clone <repository-url>
    cd himatika
  2. Install dependencies (Bun is the only supported package manager β€” the repo ships bun.lock and CI uses Bun):

    bun install
  3. Environment Setup: Create a .env file in the root directory. Copy .env.example and fill in the values (see that file for the full variable list).

    # App & Security
    APPNAME="Himatika"
    VERSION="1.0.0"
    PUBLIC_URI="http://localhost:3000"
    PUBLIC_URI_API="http://localhost:3000/api"
    JWT_SECRET="your_jwt_secret"
    NODE_ENV="development"
    
    # Database
    HIMATIKA_MONGODB_URI="mongodb://localhost:27017"
    DBNAME="himatika"
    
    # Storage (Cloudflare R2)
    R2_ACCOUNT_ID="..."
    R2_ACCESS_KEY_ID="..."
    R2_SECRET_ACCESS_KEY="..."
    R2_BUCKET_NAME="..."
    R2_PUBLIC_DOMAIN="..."
    
    # Mail (Resend)
    RESEND_API_KEY="..."
    RESEND_FROM="..."
    
    # Payment (Midtrans)
    MIDTRANS_URL="https://app.sandbox.midtrans.com/snap/v1/transactions"
    MIDTRANS_CLIENT_KEY="..."
    MIDTRANS_SERVER_KEY="..."
    
    # Encryption (openssl rand -hex 32) β€” rotating it makes old encrypted data unreadable
    ENCRYPTION_KEY="..."

    See .env.example for additional optional variables (reCAPTCHA, Google OAuth, QStash, WAHA, PDF worker).

  4. Run Development Server:

    bun run dev

    Access the app at http://localhost:3000.

πŸ“œ Build & Deployment

The application uses different rendering strategies (routeRules) for optimization:

  • SPA: Dashboard, Profile, Admin pages.
  • SSR + SWR: News, Agendas.
  • SPA: Auth pages (Login, Register).

To build for production (memory-hungry β€” the script raises Node's heap automatically):

bun run build

Preview the production build locally:

bun run preview

πŸ“‚ Project Structure

  • /app: Main Vue/Nuxt application code.
  • /server: API routes and backend logic (Nitro).
  • /locales: i18n translation files.
  • /public: Static assets.
  • /types: TypeScript type definitions.

πŸ›‘οΈ Security & Best Practices

The codebase implements several security standards that must be maintained:

Authentication

  • Secure by Default: The auth middleware blocks all routes by default. Public routes must be explicitly allowlisted in server/middleware/auth.ts.
  • Session: Uses sidebase/nuxt-auth with JWT.

Input Validation

  • Password Policy: Always use validatePassword from server/utils/validatePassword.ts for any password set/change operations.
    • Min 8 chars, 1 Uppercase, 1 Lowercase, 1 Number.
  • Sanitization: Avoid passing full Request Body to Mongoose models. Destructure strict fields.

Concurrency

  • Atomic Operations: For high-concurrency actions (like Event Registration), use Atomic MongoDB operators ($push, $addToSet with query conditions) instead of "Read-Check-Write" in memory to prevent race conditions.

Internationalization (i18n)

  • Backend Emails: All email templates (Agenda, OTP) must use useTranslationServerMiddleware to respect the user's locale. Hardcoded strings in emails are prohibited.

πŸ“Š System Design

Architecture

graph TD
    User[User / Client] <-->|HTTPS| LoB[Load Balancer / Vercel]
    LoB <-->|Nuxt 3| App[Application Server]
    
    subgraph "Backend Services"
        App <-->|Mongoose| DB[(MongoDB)]
        App <-->|AWS SDK| Storage[Object Storage <S3/R2>]
        App -->|SMTP| Mail[Mailtrap]
        App <-->|API| Payment[Midtrans Payment Gateway]
    end

    subgraph "Core Modules"
        Auth[Authentication]
        CMS[Content Management]
        Event[Event System]
    end
    
    App --- Auth
    App --- CMS
    App --- Event
Loading

Database Schema (ERD)

Simplified Entity-Relationship Diagram focusing on core interactions:

erDiagram
    User ||--|| Member : "linked to"
    Agenda ||--o{ Committee : "organized by"
    Agenda ||--o{ Participant : "attended by"
    
    Member ||--o{ Committee : "joins as"
    Member ||--o{ Participant : "registers as"
    Member ||--o{ Project : "contributes to"
    Member ||--o{ Aspiration : "submits"
    
    Agenda }|--|| Category : "has"
    
    Committee {
        string job
        string status
    }
    
    Participant {
        string type
        boolean visiting
    }

    Member {
        string NIM
        string fullName
        string email
        string status
    }
Loading

Registration Flow

Sequence of events when a member registers for an account:

sequenceDiagram
    participant Client
    participant API as Server (Nitro)
    participant DB as MongoDB

    Client->>API: POST /api/register (NIM, Data)
    activate API
    
    API->>DB: Find Member by NIM
    alt Member Not Found
        API-->>Client: Error 400 (NIM not found)
    else Member Found
        API->>DB: Check prerequisites (Status, Email)
        alt Prerequisites Failed
            API-->>Client: Error 400 (Already registered/Active)
        else Valid
            API->>DB: Create User Account
            API->>DB: Link User to Member
            API-->>Client: Success 200
        end
    end
    
    deactivate API
Loading

Payment Integration Flow

Interaction with Midtrans Payment Gateway:

sequenceDiagram
    participant User
    participant App
    participant Midtrans

    User->>App: POST /payment (Select Method)
    activate App
    App->>Midtrans: Create Charge (API)
    activate Midtrans
    Midtrans-->>App: Return Payment Info (VA/QRIS)
    deactivate Midtrans
    App-->>User: Display Payment Instructions
    deactivate App

    User->>Midtrans: Perform Payment
    midtrans->>App: Webhook /notification (Payment Success)
    activate App
    App->>App: Verify Signature
    App->>App: Update Transaction Status
    deactivate App
Loading

Event Lifecycle

The lifecycle of an event participant:

stateDiagram-v2
    [*] --> Registered: User Registers
    Registered --> PendingPayment: Fee Required
    Registered --> Confirmed: Free Event
    
    PendingPayment --> Confirmed: Payment Verified (Webhook)
    PendingPayment --> Cancelled: Expired/failed
    
    Confirmed --> Attended: QR Scan (On-site)
    Attended --> [*]
    Cancelled --> [*]
Loading

Points System Logic

How member points are calculated per semester:

graph LR
    subgraph "Data Sources"
        A[Agenda Participation]
        B[Committee Role]
        C[Projects <75pt>]
        D[Aspirations <50pt>]
        E[Manual Logs]
    end

    subgraph "Filters"
        DateRange{Within Semester?}
        Status{Verification Status?}
    end

    subgraph "Calculation"
        Sum((Sum Total))
        Result[Member Point]
    end

    A --> DateRange
    B --> DateRange
    C --> DateRange
    D --> DateRange
    E --> Status
    Status --> DateRange

    DateRange -->|Valid| Sum
    Sum --> Result
Loading

Digital Signature Flow

Secure signing process for documents:

sequenceDiagram
    participant User
    participant App
    participant Encrypt as Encryption Service
    participant PDF as PDF Processor
    participant DB

    User->>App: Sign Document (DocID, Coords)
    activate App
    
    App->>DB: Fetch Member & Encryption Key
    App->>Encrypt: Decrypt Private Key
    App->>Encrypt: Sign Data Hash (SHA-256)
    Encrypt-->>App: Digital Signature
    
    App->>DB: Save Signature Record
    App->>PDF: Overlay QR Code on PDF
    activate PDF
    PDF-->>App: Updated PDF File
    deactivate PDF
    
    App->>DB: Update Document Status & Audit Trail
    App-->>User: Success (Signature Applied)
    deactivate App
Loading

About

Platform manajemen organisasi mahasiswa terpadu yang dibangun dengan arsitektur monorepo modern. Sistem ini dirancang untuk mendigitalisasi seluruh ekosistem kegiatan organisasi, mulai dari manajemen keanggotaan, administrasi dokumen otomatis, hingga sistem keterlibatan anggota (gamification).

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages