The base branch is develop
.
Note The following commands are for Linux/Mac environments. For Windows, please use WSL2.
# Enable the Package Manager
corepack enable
# Install project dependencies
pnpm install
We support SQLite (dev only) and PostgreSQL. PostgreSQL is recommended and requires Docker installed.
# Switch between SQLite and PostgreSQL
make switch-db-mode
cd apps/nextjs-app
cp .env.development .env.development.local
cd apps/nestjs-backend
pnpm dev
This will automatically start both backend and frontend servers with hot reload enabled.
After pulling the latest code, ensure your development environment stays up-to-date:
# Update dependencies to latest versions
pnpm install
# Update database schema to latest version
make switch-db-mode
Port conflict: In dev mode, code changes trigger hot reloading. If changes affect app/nestjs-backend (packages/core, packages/db-main-prisma), nodejs may restart, potentially causing port conflicts.
If backend code changes seem ineffective, check if the port is occupied with lsof -i:3000
. If so, kill the old process with kill -9 [pid]
and restart the application with pnpm dev
.
Websocket: In development, Next.js occupies port 3000 for websocket to trigger hot reloading. To avoid conflicts, the application's websocket uses port 3001. That's why you see SOCKET_PORT=3001 in .env.development.local, while in production, port 3000 is used by default for websocket requests.
Teable uses Prisma as ORM for database management. Follow these steps for schema changes:
-
Modify
packages/db-main-prisma/prisma/template.prisma
-
Generate Prisma schemas:
make gen-prisma-schema
This generates both SQLite and PostgreSQL schemas and TypeScript definitions.
- Create migrations file:
make db-migration
- Apply migrations:
make switch-db-mode
Note If you need to modify the schema after applying migrations, you need to delete the latest migration file and run
pnpm prisma-migrate-reset
inpackages/db-main-prisma
to reset the database. (Make sure you run it in the development database.)
Located in apps/nestjs-backend
:
# First-time setup
pnpm pre-test-e2e
# Run all E2E tests
pnpm test-e2e
# Run specific test file
pnpm test-e2e [test-file]
# Run all unit tests
pnpm g:test-unit
# Run tests in specific package
cd packages/[package-name]
pnpm test-unit
# Run specific test file
pnpm test-unit [test-file]
Using VSCode/Cursor:
-
For E2E tests in
apps/nestjs-backend
:- Switch to test file (e.g.
apps/nestjs-backend/test/record.e2e-spec.ts
) - Select "vitest e2e nest backend" in Debug panel
- Switch to test file (e.g.
-
For unit tests in different packages:
- For
packages/core
:- Switch to test file (e.g.
packages/core/src/utils/date.spec.ts
) - Select "vitest core" in Debug panel
- Switch to test file (e.g.
- For other packages, select their corresponding debug configuration
- For
Each package has its own debug configuration in VSCode/Cursor, make sure to select the matching one for the package you're testing.
This repo follows conventional commit format.
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- test: Adding or modifying tests
- refactor: Code changes that neither fix bugs nor add features
- style: Changes to styling/CSS
- chore: Changes to build process or tools
Note Full configuration can be found in commitlint.config.js
We have two main Docker images:
teable
: The main application imageteable-db-migrate
: Database migration tool (one-time setup tool)
Note You should run this command in the root directory.
# Build the main application image
docker build -f dockers/teable/Dockerfile -t teable:latest .
# Build for a specific platform (e.g., amd64)
docker build --platform linux/amd64 -f dockers/teable/Dockerfile -t teable:latest .
# Build the database migration image
docker build -f dockers/teable/Dockerfile.db-migrate -t teable-db-migrate:latest .
Important The
teable-db-migrate
image is used for database schema migrations. It should be run once before starting the main application. The container will automatically exit after completing the migrations.
# Tag your local image
docker tag teable:latest your-username/teable:latest
docker tag teable-db-migrate:latest your-username/teable-db-migrate:latest
# Login to Docker Hub
docker login
# Push the image
docker push your-username/teable:latest
docker push your-username/teable-db-migrate:latest