116 lines
2.9 KiB
Markdown
116 lines
2.9 KiB
Markdown
# Multi-Tenant Nova/Salesforce-like Platform
|
|
|
|
A multi-tenant application platform where tenants can define custom objects, fields, applications, and pages.
|
|
|
|
## Architecture
|
|
|
|
- **Backend**: NestJS + Fastify + Prisma + Redis + BullMQ
|
|
- **Frontend**: Nuxt 3 + Vue 3 + Tailwind CSS + shadcn-vue
|
|
- **Database**: Percona (MySQL-compatible)
|
|
- **Cache/Queue**: Redis + BullMQ
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
neo/
|
|
backend/ # NestJS + Prisma + BullMQ
|
|
src/
|
|
prisma/
|
|
package.json
|
|
tsconfig.json
|
|
Dockerfile
|
|
frontend/ # Nuxt 3 + Vue 3 + Tailwind + shadcn-vue
|
|
app/
|
|
package.json
|
|
nuxt.config.ts
|
|
Dockerfile
|
|
infra/
|
|
docker-compose.yml
|
|
.env.api
|
|
.env.web
|
|
README.md
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Docker & Docker Compose
|
|
- Node.js 22+ (for local development)
|
|
|
|
### Development Setup
|
|
|
|
1. Clone the repository
|
|
2. Start all services:
|
|
|
|
```bash
|
|
cd infra
|
|
docker-compose up --build
|
|
```
|
|
|
|
This will start:
|
|
- API server on http://localhost:3000
|
|
- Web UI on http://localhost:3001
|
|
- Percona MySQL on localhost:3306
|
|
- Redis on localhost:6379
|
|
|
|
### Running Migrations
|
|
|
|
```bash
|
|
# From the infra directory
|
|
docker-compose exec api npx prisma migrate dev
|
|
```
|
|
|
|
## Features
|
|
|
|
### Multi-Tenancy
|
|
- Single database with `tenantId` on all tenant-specific rows
|
|
- Tenant context via `x-tenant-id` header
|
|
|
|
### Object & Field Management
|
|
- Define custom objects and fields via `/api/setup/objects`
|
|
- Runtime CRUD operations via `/api/runtime/objects/:objectApiName/records`
|
|
|
|
### Application Builder
|
|
- Create applications with multiple pages
|
|
- Access apps via `/app/:appSlug/:pageSlug`
|
|
- Configure apps via `/setup/apps`
|
|
|
|
### Security
|
|
- JWT-based authentication
|
|
- Role-based access control (RBAC) with Spatie-like permissions
|
|
- Field-level security (FLS)
|
|
- Record ownership and sharing rules
|
|
|
|
## API Endpoints
|
|
|
|
### Runtime APIs
|
|
- `GET /api/runtime/apps` - List apps for current user
|
|
- `GET /api/runtime/apps/:appSlug` - Get app with pages
|
|
- `GET /api/runtime/apps/:appSlug/pages/:pageSlug` - Get page metadata
|
|
- `GET /api/runtime/objects/:objectApiName/records` - List records
|
|
- `GET /api/runtime/objects/:objectApiName/records/:id` - Get record
|
|
- `POST /api/runtime/objects/:objectApiName/records` - Create record
|
|
- `PUT /api/runtime/objects/:objectApiName/records/:id` - Update record
|
|
- `DELETE /api/runtime/objects/:objectApiName/records/:id` - Delete record
|
|
|
|
### Setup APIs
|
|
- `GET /api/setup/objects` - List object definitions
|
|
- `POST /api/setup/objects` - Create custom object
|
|
- `POST /api/setup/objects/:objectApiName/fields` - Add field
|
|
- `GET /api/setup/apps` - List apps
|
|
- `POST /api/setup/apps` - Create app
|
|
- `POST /api/setup/apps/:appSlug/pages` - Add page
|
|
|
|
## Frontend Routes
|
|
|
|
- `/app/:appSlug` - App home (redirects to first page)
|
|
- `/app/:appSlug/:pageSlug` - Page view (list/board/dashboard)
|
|
- `/app/:appSlug/:pageSlug/:recordId` - Record detail view
|
|
- `/setup/apps` - App builder UI
|
|
- `/setup/objects` - Object/field builder UI
|
|
|
|
## License
|
|
|
|
MIT
|