Use this guide if you want to contribute code, docs, or examples to Cossistant. It walks through the local setup, the services that should be running, the parts of the monorepo you will touch most often, and the checks to run before you open a pull request.
Prerequisites
Before you start, make sure your machine has:
- Docker Desktop - Required for running Postgres and Redis locally
- Bun v1.2+ - Our package manager and runtime (install Bun)
- Git - For version control
- Node-compatible shell tooling - Helpful for local debugging and scripts
Quick Start
Clone the monorepo, install dependencies, and start the local stack:
git clone https://github.com/cossistantcom/cossistant.git
cd cossistant
bun install --workspaces
bun devThat's it! The bun dev command will:
- Start Docker Compose (Postgres + Redis containers)
- Start the API server with Upstash Workflow in local mode
- Start the Next.js web application
Upstash Workflow runs locally - No account needed! When the server starts, you'll see the workflow credentials displayed in your console. These credentials don't change between restarts.
Local Services At A Glance
After bun dev finishes, you should have:
- Web app:
http://localhost:3000for the landing site, docs, and dashboard - API server:
http://localhost:3001for REST, tRPC, WebSocket, and auth flows - Postgres:
localhost:5432for relational data - Redis:
localhost:6379for queues, caching, and real-time support - Upstash Workflow local mode: credentials printed in the API console output
Database Setup
Default connection
The local database connection string is:
postgresql://postgres:postgres@localhost:5432/cossistant
This is automatically configured when you run bun dev.
Run migrations
After starting the services for the first time, run the database migrations:
cd apps/api
bun db:migrateSeed data (optional)
To populate the database with sample data for development:
cd apps/api
bun db:seedMake schema changes
When you need to modify the database schema:
- Update the schema files in
apps/api/src/db/schema - Generate a migration:
cd apps/api bun db:generate - Apply the migration:
bun db:migrate
Open Database Studio
To explore the database with Drizzle Studio:
cd apps/api
bun db:studioOptional S3 Setup
S3 file storage is only needed if you're testing file uploads. For most development work, you can skip this.
If you do need S3:
- Navigate to the infrastructure directory:
cd infra/aws/s3-public-setup - Follow the instructions in the S3 Setup README
- The Terraform configuration will create the necessary AWS resources
Repo Map For Contributors
These are the directories most contributors touch:
Apps
-
apps/api- Hono + tRPC backend with WebSocket server- RESTful and tRPC APIs
- Real-time WebSocket communication
- Database queries and mutations
- Authentication via Better Auth
- Background jobs via Upstash Workflow
-
apps/web- Next.js application- Marketing landing page
- Documentation (Fumadocs)
- Dashboard interface
Packages
-
packages/react- Main React SDK- Headless hooks and primitives
- Pre-built
<Support />component - Real-time WebSocket integration
-
packages/next- Next.js-specific SDK- Server Component support
- Next.js optimized bindings
-
packages/core- Shared client logic- State management stores
- REST and WebSocket clients
- Utility functions
-
packages/types- TypeScript definitions- Shared types across all packages
- API schemas and validation
-
packages/transactional- Email templates- React Email templates
- Transactional email utilities
-
packages/location- Location utilities- Country and timezone data
- Geolocation helpers
Contributor Workflow
Root commands
Run these from the repo root:
# Start all services
bun dev
# Build all packages
bun run build
# Build specific package
bun run build --filter @cossistant/react
# Run linter and auto-fix issues
bun run fix
# Type check all packages
bun run check-types
# Check documentation links
bun run docs:linksAPI-specific commands
Run these from apps/api:
# Start API server only
bun run dev
# Run migrations
bun run db:migrate
# Seed database
bun run db:seed
# Open Drizzle Studio
bun run db:studio
# Generate Better Auth schema
bun run better-auth:generate-schemaQuality Checks Before A Pull Request
Run the smallest set of checks that matches your change:
# Auto-fix linting issues across the repo
bun run fix
# Verify TypeScript types
bun run check-types
# Run docs link checks for documentation edits
bun run docs:links
# Run tests in the package or app you changed
cd packages/react
bun testIf you changed the API, run tests from apps/api. If you changed docs or marketing pages, make sure the affected pages still build and render cleanly.
Pull Request Checklist
Before you open or merge a PR:
- Use a clear Conventional Commits title such as
fix: tighten llms route indexing headers. - Explain what changed, why it changed, and any follow-up work still pending.
- Link the related issue, discussion, or support thread when there is one.
- Add screenshots or recordings for UI changes.
- Add a changeset when you touch published packages such as
@cossistant/reactor@cossistant/next. - Mention any environment variables, migrations, or manual QA steps reviewers need.
Testing Notes
Cossistant uses Bun's built-in test runner. Tests are colocated with source files using the *.test.ts naming convention.
# Run tests in a specific package
cd packages/react
bun test
# Watch mode
bun test --watch
# Coverage report
bun test --coverageTroubleshooting
bun devfails immediately: confirm Docker Desktop is running and ports3000,3001,5432, and6379are not already taken.- Database errors after pulling main: rerun
bun db:migratefromapps/apito catch up with schema changes. - Missing dependencies or stale lockfile state: rerun
bun install --workspacesfrom the repo root. - Docs pages render but links fail: run
bun run docs:linksbefore opening the PR. - You only need package-level tests: run
bun testinside the package you changed instead of the entire monorepo.
Commit Message Format
We follow Conventional Commits for commit messages:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changeschore:- Maintenance tasksrefactor:- Code refactoringtest:- Test updates
Example: feat: add message reactions to timeline items
Changesets
For changes to published packages (@cossistant/react, @cossistant/next), add a changeset:
bun run changesetFollow the prompts to describe your changes. This will be used to generate changelogs and version bumps.
Getting Help
- Documentation: cossistant.com/docs
- Discord: Join our community
- GitHub Issues: Report bugs or request features
License
Cossistant is licensed under AGPL-3.0 for non-commercial use. For commercial use, please contact us at [email protected].
On this page
PrerequisitesQuick StartLocal Services At A GlanceDatabase SetupDefault connectionRun migrationsSeed data (optional)Make schema changesOpen Database StudioOptional S3 SetupRepo Map For ContributorsAppsPackagesContributor WorkflowRoot commandsAPI-specific commandsQuality Checks Before A Pull RequestPull Request ChecklistTesting NotesTroubleshootingCommit Message FormatChangesetsGetting HelpLicense