Multi-tenant enterprise application with wildcard subdomain routing.
- Frontend: React/TS/Vite
- Backend: Node.js/Express
- Database: PG/RLS
- Multi-tenant architecture with subdomain routing (*.tld)
- Row-Level Security (RLS) for tenant data isolation
- Regional dashboards with tenant-specific data
- Admin and counsel management per tenant
# Install dependencies
make install
# Build the application
make build
# Start with docker-compose
make up
# View logs
make logs
# Run health checks
make health
# Stop services
make downSee make help for all available commands.
Zenbase uses Screwdriver.cd for automated builds and deployments. See SCREWDRIVER.md for detailed documentation.
Subdomains automatically route to tenants:
- https://seattle.zenbase.online
- https://portland.zenbase.online
- http://localhost:5173?tenant=seattle
- http://localhost:5173?tenant=portland
phase auth
make up
Secrets are managed.
# Wildcard certs for *.zenbase.online
fly certs add "*.zenbase.online"
fly certs add "zenbase.online".
├── backend/
│ ├── src/
│ │ ├── lib/
│ │ │ └── supabase.js # Supabase client with RLS
│ │ ├── middleware/
│ │ │ ├── auth.js # Authentication middleware
│ │ │ └── tenant.js # Tenant context extraction
│ │ ├── routes/
│ │ │ └── tenant.js # Tenant API routes
│ │ └── server.js # Express server
│ ├── package.json
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── hooks/
│ │ │ └── useTenant.ts # Tenant context hook
│ │ ├── lib/
│ │ │ └── supabase.ts # Supabase client
│ │ ├── pages/
│ │ │ ├── Dashboard.tsx # Tenant dashboard
│ │ │ └── Login.tsx # Authentication
│ │ ├── App.tsx
│ │ └── main.tsx
│ ├── package.json
│ └── .env.example
├── docker-compose.yml
├── Dockerfile
├── fly.toml
└── README.md
GET /health- Health check
GET /api/tenant/info- Get tenant informationGET /api/tenant/dashboard- Get dashboard data (requires auth)GET /api/tenant/admins- Get tenant admins (requires auth)
Tenant isolation is enforced at multiple levels:
- Subdomain Routing: Middleware extracts tenant from subdomain
- Database RLS: PostgreSQL Row-Level Security policies
- API Layer: Tenant context validated on every request
- Client Context: Frontend hooks manage tenant state
This project utilizes devcontainer ephemeral environments, enabling rapid development and testing.
MIT