Event creation, membership management, and approval workflows for IEEE SBNU.
Atrium is the internal management portal for IEEE Student Branch of Nirma University (SBNU). It handles:
- π Authentication β Google OAuth + email/password with
@nirmauni.ac.indomain restriction - β Registration Gating β New members require admin/MDO approval before accessing the portal
- π Permission-Based Access β Granular, position-based permissions determine what each member sees
- π Event Management β Create, submit, approve, and publish events through a multi-level approval workflow
- π₯ Membership Management β Track positions, branches, role history, and direct permission grants
- π Audit Trail β Immutable logs of all event and membership changes
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 16 (App Router) | Full-stack React framework with Server Actions |
| Language | TypeScript 5 | Type-safe development |
| Auth | NextAuth.js v5 (Auth.js) | Google OAuth + Credentials with JWT sessions |
| Database | Supabase (PostgreSQL) | Managed Postgres with admin client access |
| Styling | Tailwind CSS 4 + shadcn/ui | Utility-first CSS + accessible component library |
| Deployment | Vercel | Edge-optimized hosting with auto-deploys from GitHub |
| Icons | Lucide React | Consistent icon set |
| Fonts | Google Sans | Brand typography |
Atrium/
βββ docs/ # π Documentation
β βββ AUTH.md # Authentication & authorization deep-dive
β βββ SCHEMA.md # Database schema reference (single source of truth)
β
βββ implementation_plans/ # π Historical implementation plans
β βββ implementation_plan_for_auth
β βββ implementation_plan_for_Oauth-2
β βββ implementation_plan_for_GCP-and-NextAuth_setup
β βββ implementation_plan_for_Dashbord-phase-1
β βββ implementation_plan-brainstorming-superadmin
β
βββ supabase/
β βββ migrations/ # ποΈ Database migrations (run in Supabase SQL editor)
β βββ 00001_initial_schema.sql
β βββ 00002_permission_system.sql
β βββ 00003_nextauth_migration.sql
β βββ 00004_invisible_superadmin.sql
β βββ 00005_new_positions.sql
β βββ 00006_workspace_and_requests.sql
β βββ 00007_notification_types.sql
β βββ 00008_audit_log.sql
β
βββ src/
β βββ app/
β β βββ (portal)/ # π Dashboard route group (shared sidebar layout)
β β β βββ page.tsx # Dashboard home
β β βββ api/auth/[...nextauth] # NextAuth API routes (auto-generated)
β β βββ auth/actions.ts # Server actions: signUp, signIn, signOut, etc.
β β βββ login/ # Login page (Google + email/password)
β β βββ signup/ # Registration page
β β βββ complete-registration/ # IEEE details form (Google OAuth users)
β β βββ pending/ # Waiting room for unapproved accounts
β β βββ rejected/ # Rejection notice with reason
β β βββ superadmin/ # SuperAdmin portal (dashboard, orgs, users, positions, requests, audit, settings)
β β βββ layout.tsx # Root layout
β β βββ globals.css # Theme variables & base styles
β β
β βββ components/
β β βββ ui/ # shadcn/ui components (Button, Card, Input, etc.)
β β
β βββ lib/ # Shared utilities & query helpers
β β
β βββ utils/
β β βββ auth/
β β β βββ permissions.ts # Permission engine (position + direct grants)
β β β βββ superadmin.ts # SuperAdmin identity check (bcrypt-matched email β session.isSuperAdmin)
β β β βββ audit.ts # logAdminAction() β writes to audit_log
β β β βββ impersonation.ts # Workspace impersonation (SuperAdmin "view as member")
β β βββ supabase/
β β βββ server.ts # createAdminClient() (service role)
β β βββ middleware.ts # Auth middleware (route protection)
β β
β βββ auth.config.ts # NextAuth config (Edge-safe, Google provider)
β βββ auth.ts # NextAuth config (Node.js, adds Credentials + bcrypt)
β βββ middleware.ts # Next.js middleware entry point
β
βββ .env # Environment variables (not committed)
βββ package.json
βββ tsconfig.json
βββ next.config.ts
π Start at docs/README.md β the full developer documentation index (what/how/why/gotchas for every feature). Highlights:
| Document | Description |
|---|---|
| docs/README.md | Documentation index & "start here" map |
| ARCHITECTURE.md | System overview, request lifecycle, Edge/Node split, directory map |
| ENGINEERING.md | Conventions, patterns, gotchas, "add a feature" recipe |
| DEVELOPMENT.md | Setup, complete env-var list, migrations, verification |
| AUTH.md | Authentication & identity: NextAuth, Google/credentials, super-admin, middleware (current invisible-super-admin model) |
| PERMISSIONS.md | Positions + permissions + memberships; how access is computed |
| SCHEMA.md | Database schema reference (v2) β every table, enum, index, migration |
| features/ | Per-feature deep dives: notifications, super-admin portal, impersonation, workspace switching, approvals, position requests, members, dashboard, events |
- Node.js 18+
- npm 9+
- A Supabase project (supabase.com)
- A Google Cloud project with OAuth 2.0 credentials (console.cloud.google.com)
git clone https://github.com/IEEE-Student-Branch-NU/Atrium.git
cd Atriumnpm installCreate a .env file in the project root:
# ββ Supabase ββββββββββββββββββββββββββββββββββββββ
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# ββ NextAuth.js βββββββββββββββββββββββββββββββββββ
AUTH_SECRET=your-random-secret-string
NEXTAUTH_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
# ββ Google OAuth ββββββββββββββββββββββββββββββββββ
AUTH_GOOGLE_ID=your-google-client-id.apps.googleusercontent.com
AUTH_GOOGLE_SECRET=GOCSPX-your-google-client-secret
# ββ Password Hashing βββββββββββββββββββββββββββββ
BCRYPT_SALT_ROUNDS=12
# ββ Email (Resend) β optional βββββββββββββββββββββ
# Powers email delivery for high-signal notifications (welcome, approvals,
# promotions). If unset, the app runs normally and email sends are a no-op.
RESEND_API_KEY=re_your_resend_api_key
EMAIL_FROM=Atrium <no-reply@your-verified-domain>Google OAuth Setup: In the Google Cloud Console, add
http://localhost:3000to Authorized JavaScript Origins andhttp://localhost:3000/api/auth/callback/googleto Authorized Redirect URIs. See AUTH.md for details.
Run the migrations in order in your Supabase SQL editor:
supabase/migrations/00001_initial_schema.sqlβ Core tables, branches, positions, eventssupabase/migrations/00002_permission_system.sqlβ Permissions, position_permissions, pre-approvalsupabase/migrations/00003_nextauth_migration.sqlβ NextAuth-specific columns (password_hash)supabase/migrations/00004_invisible_superadmin.sqlβ Superadmins tablesupabase/migrations/00005_new_positions.sqlβ Seeds Web Master, Treasurer, Technical Associate, Marketing Associate positionssupabase/migrations/00006_workspace_and_requests.sqlβ position_requests, notifications tablessupabase/migrations/00007_notification_types.sqlβ notifications.type columnsupabase/migrations/00008_audit_log.sqlβ Unifiedaudit_logtable for the SuperAdmin portal (required for/superadmin/auditto show data)supabase/migrations/00009_broadcast_notifications.sqlβ Broadcast notifications + realtime publication + RLSsupabase/migrations/00010_hardcoded_superadmin_profile.sqlβ Seeds the fixed super-admin profile rowsupabase/migrations/00011_notification_routing.sqlβ Notification routing:audience/branch_id/event_key/actor_profile_id, Chair-scoped RLS (required for the notification system)
npm run devOpen http://localhost:3000 β you'll see the login page.
Atrium supports two authentication methods, both restricted to @nirmauni.ac.in:
flowchart LR
A["Login Page"] --> B["Google OAuth"]
A --> C["Email + Password"]
B --> D["NextAuth JWT"]
C --> D
D --> E{"Middleware"}
E -->|"approved"| F["Dashboard β
"]
E -->|"pending"| G["Waiting Room β³"]
E -->|"no IEEE ID"| H["Complete Registration"]
New users must be approved by an Admin or MDO before accessing the portal. Pre-approved IEEE Membership IDs skip the queue automatically.
β Full details: docs/AUTH.md
The database uses PostgreSQL via Supabase with a permission-based access control system.
| Table | Purpose |
|---|---|
profiles |
User identity, status, IEEE membership |
branches |
IEEE organizational hierarchy (SBNU β CS, WIE, SIGHT, etc.) |
positions |
Branch-scoped titles (Chair, Vice Chair, MDO, etc.) |
permissions |
Atomic actions (create_events, approve_registrations, etc.) |
memberships |
Append-only history: who held what position, when |
events |
Core event entity with status machine |
event_approvals |
Multi-level approval tracking |
| Branch | Slug | Parent |
|---|---|---|
| IEEE SBNU | sbnu |
β (root) |
| IEEE SIGHT | sight |
SBNU |
| IEEE WIE | wie |
SBNU |
| IEEE CS | cs |
SBNU |
| IEEE ITSS | itss |
SBNU |
| IEEE SPS | sps |
SBNU |
β Full schema reference: docs/SCHEMA.md
Permissions are position-based + direct grants. The system follows the principle of least privilege.
| Permission | Chair | Vice Chair | Gen Sec | Tech Head | Creative Head | MDO |
|---|---|---|---|---|---|---|
create_events |
β | β | β | β | β | |
approve_events |
β | β | ||||
manage_events |
β | β | ||||
manage_members |
β | β | ||||
approve_registrations |
β | β | β | |||
view_members |
β | β | β | β | β | |
view_audit_log |
β | β | β |
New positions (Treasurer, Web Master, Technical Associate, Marketing Associate) start with no default permissions. An admin can grant them via the Manage Members module.
β Full permission engine details: docs/AUTH.md#6-permission-engine
The app is deployed on Vercel with auto-deploys from the main branch.
| Environment | URL |
|---|---|
| Production (Vercel) | atrium-ieeenirma.vercel.app |
| Custom Domain | atrium.ieeenirma.org |
| Local | localhost:3000 |
Set all variables from the .env section above in Vercel β Project Settings β Environment Variables. For production, update:
NEXTAUTH_URL=https://atrium-ieeenirma.vercel.app
NEXT_PUBLIC_APP_URL=https://atrium-ieeenirma.vercel.app
In the Google Cloud Console, add these to your OAuth Client:
- Authorized JavaScript Origins:
https://atrium-ieeenirma.vercel.app,https://atrium.ieeenirma.org - Authorized Redirect URIs:
https://atrium-ieeenirma.vercel.app/api/auth/callback/google,https://atrium.ieeenirma.org/api/auth/callback/google
| # | Migration | Description |
|---|---|---|
| 1 | 00001_initial_schema.sql |
Core tables: profiles, branches, positions, memberships, events, event_types, event_approvals, audit logs. Seeded branches and positions. |
| 2 | 00002_permission_system.sql |
Permission engine: permissions, position_permissions, member_permissions, pre_approved_members. Dropped old portal_role enum. Full permission matrix seed. |
| 3 | 00003_nextauth_migration.sql |
Added password_hash to profiles. NextAuth compatibility columns. |
| 4 | 00004_invisible_superadmin.sql |
Created superadmins table (bcrypt-hashed emails + passphrase hash), RLS enabled with no public policies. Dropped profiles.is_super_admin β SuperAdmin status is no longer a queryable column. |
| 5 | 00005_new_positions.sql |
Seed script for adding missing standard roles: Web Master, Treasurer, Technical Associate, Marketing Associate, and granting basic permissions. |
| 6 | 00006_workspace_and_requests.sql |
Added bio/skills to profiles. Added position_requests table (member-initiated requests to hold a position) and notifications table. |
| 7 | 00007_notification_types.sql |
Added notifications.type column (normal, broadcast, success, warning, error). |
| 8 | 00008_audit_log.sql |
Added unified audit_log table recording super-admin/structural actions (branch/position/permission changes, workspace impersonation, etc.), with indexes on created_at, actor_profile_id, and (entity_type, entity_id). RLS enabled with no public policies (service-role only). |
| Command | Description |
|---|---|
npm run dev |
Start development server (hot reload) |
npm run build |
Production build |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npx shadcn@latest add <component-name>- Server Actions for all mutations (no API routes for forms)
- Server Components by default;
'use client'only when needed - Supabase Admin Client for all DB access (never browser client)
- bcrypt for password hashing (Node.js runtime only)
- JWT sessions (no database sessions)
This repository is configured to be used with AI coding assistants (like Claude, Cursor, Aider, Copilot, or Antigravity) using Graphify. Graphify maps the codebase into a queryable knowledge graph, giving your AI agents a deep understanding of the project's architecture and inter-dependencies out-of-the-box.
When you clone the repository, open it in your AI coding assistant of choice and run:
/graphify .(Or run graphify extract . via CLI). The agent will automatically use the generated graph for all codebase-related questions.
IEEE Student Branch of Nirma University
- Organization: IEEE-Student-Branch-NU
- Repository: Atrium