A modular, enterprise-grade safety management system built with Next.js, TypeScript, and Supabase.
- Modular Architecture: Plugin-based safety modules using the Safety Framework
- Incident Reporting: Track and manage safety incidents with persistent database storage
- Modern UI: Built with Tailwind CSS and shadcn/ui components
- Type-Safe: Full TypeScript coverage with Drizzle ORM for database operations
- Node.js 18+ and npm
- A Supabase account and project (supabase.com)
- PostgreSQL database access (provided by Supabase)
This project uses Supabase PostgreSQL for data persistence with Drizzle ORM.
- Go to supabase.com and create a new project
- Wait for your database to be provisioned
- Navigate to Settings > Database
- Copy your Connection string (URI format)
-
Copy the example environment file:
cp .env.local.example .env.local
-
Edit
.env.localand add your Supabase database URL:DATABASE_URL="postgresql://postgres:[YOUR-PASSWORD]@db.[YOUR-PROJECT-REF].supabase.co:5432/postgres"
Replace:
[YOUR-PASSWORD]with your database password[YOUR-PROJECT-REF]with your Supabase project reference
Apply the database schema to your Supabase database:
npx drizzle-kit pushThis will create the incidents table and all necessary schema.
To add sample incidents to your database, you can use the Supabase SQL editor or create a seed script.
-
Install dependencies:
npm install
-
Set up database (see Database Setup above)
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
├── app/ # Next.js 15 App Router pages
│ ├── dashboard/ # Dashboard layouts and module pages
│ └── page.tsx # Home page
├── components/ # Reusable UI components
│ ├── ui/ # shadcn/ui components
│ └── dashboard/ # Dashboard-specific components
├── lib/
│ ├── db/ # Database layer
│ │ ├── schema/ # Drizzle schema definitions
│ │ ├── repositories/ # Data access repositories
│ │ ├── client.ts # Database client
│ │ └── types.ts # TypeScript types
│ ├── modules/ # Safety modules
│ │ └── incident-reporting/ # Incident reporting module
│ └── safety-framework/ # Module registry and lifecycle
├── drizzle/ # Database migrations
└── openspec/ # OpenSpec proposals and specs
- Generate migration:
npx drizzle-kit generate - Push schema to database:
npx drizzle-kit push - Open Drizzle Studio:
npx drizzle-kit studio
- Build:
npm run build - Lint:
npm run lint - Type check:
npx tsc --noEmit
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Database: Supabase PostgreSQL
- ORM: Drizzle ORM
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Architecture: OpenSpec-driven development
- Push your code to GitHub
- Import your repository on Vercel
- Add your
DATABASE_URLenvironment variable in project settings - Deploy!
Check out the Next.js deployment documentation for more details.