Contributing to SonicJS
This guide is for developers who want to contribute to the SonicJS platform itself. If you're building an application with SonicJS, see the Installation guide instead.
Before You Start
We appreciate every developer who wants to contribute to SonicJS. To ensure the best experience for both contributors and maintainers, we've established a clear process for getting involved.
Important: Start with Code, Not Meetings
We receive many requests from developers interested in contributing. While we value every potential contributor, we've found that the most effective way to get involved is to demonstrate your commitment through contributions first. Please submit at least one meaningful pull request before requesting a meeting or deeper integration into the project.
What Counts as a Meaningful Contribution?
Bug Fixes
Fix a bug from the issue tracker with a well-tested solution
New Features
Implement a feature that has been discussed and approved
Documentation
Significantly improve or add documentation
Test Coverage
Add meaningful tests for untested functionality
Video Content
Create tutorials, walkthroughs, or feature demos for YouTube
Create Video Content
We're looking for contributors to create video content for our YouTube channel. Video tutorials help developers learn SonicJS faster and reach a wider audience.
Video ideas:
- Getting started tutorials
- Feature walkthroughs and demos
- Building real-world projects with SonicJS
- Plugin development guides
- Tips and tricks
Reach out via GitHub Discussions if you're interested in creating video content.
Monorepo Setup
SonicJS uses a monorepo structure managed by npm workspaces. This allows us to develop the core framework, CLI tools, and documentation in a single repository.
Clone the Repository
Clone & Install
# Fork the repository on GitHub first
# Then clone your fork:
git clone https://github.com/YOUR_USERNAME/sonicjs.git
cd sonicjs
# Add upstream remote
git remote add upstream https://github.com/lane711/sonicjs.git
# Install all dependencies (installs for all workspaces)
npm install
Start Development Server
Start Development
# Start the development application
npm run dev
# Or start the documentation site
npm run dev:www
The development server runs at http://localhost:8787
Project Structure
The SonicJS monorepo is organized as follows:
sonicjs/
βββ packages/
β βββ core/ # @sonicjs-cms/core - The main framework
β β βββ src/
β β β βββ index.ts # Package entry point
β β β βββ middleware/ # Request middleware
β β β βββ routes/ # HTTP route handlers
β β β βββ services/ # Business logic
β β β βββ templates/ # HTML templates
β β β βββ plugins/ # Plugin system
β β β β βββ core/ # Plugin architecture
β β β β βββ core-plugins/ # Built-in plugins
β β β β βββ available/ # Optional plugins
β β β βββ collections/ # Collection definitions
β β β βββ types/ # TypeScript types
β β βββ migrations/ # Database migrations
β β βββ package.json
β β
β βββ create-app/ # create-sonicjs CLI tool
β βββ src/
β β βββ cli.js # CLI entry point
β βββ templates/
β β βββ starter/ # Starter project template
β βββ package.json
β
βββ www/ # Documentation website (Next.js)
β βββ src/
β β βββ app/ # MDX documentation pages
β βββ package.json
β
βββ my-sonicjs-app/ # Development/test application
β βββ src/
β β βββ index.ts # App entry point
β βββ wrangler.toml # Cloudflare config
β βββ package.json
β
βββ tests/ # E2E tests
β βββ e2e/ # Playwright tests
β βββ playwright.config.ts
β
βββ docs/ # Internal documentation
βββ package.json # Root package.json (workspaces)
βββ README.md
Key Directories
| Directory | Description |
|---|---|
packages/core | The core SonicJS framework published as @sonicjs-cms/core |
packages/create-app | The create-sonicjs CLI tool for scaffolding new projects |
www | Documentation website built with Next.js |
my-sonicjs-app | Development application for testing changes |
tests | End-to-end tests using Playwright |
Available Scripts
Root Level Scripts
Run these from the repository root:
| Command | Description |
|---|---|
npm run dev | Start development server (my-sonicjs-app) |
npm run dev:www | Start documentation site |
npm run build | Build core package and development app |
npm run build:core | Build only the core package |
npm run build:www | Build documentation site |
npm test | Run core package unit tests |
npm run test:e2e | Run Playwright end-to-end tests |
npm run deploy | Deploy development app to Cloudflare |
npm run deploy:www | Deploy documentation site |
Database Scripts
| Command | Description |
|---|---|
npm run db:generate | Generate migration files from schema changes |
npm run db:migrate | Apply migrations to local D1 database |
npm run db:migrate:prod | Apply migrations to production database |
npm run db:studio | Open Drizzle Studio (database GUI) |
Testing Scripts
| Command | Description |
|---|---|
npm test | Run Vitest unit tests |
npm run test:watch | Run tests in watch mode |
npm run test:cov | Run tests with coverage report |
npm run test:e2e | Run Playwright E2E tests |
npm run test:e2e:ui | Run E2E tests with UI mode |
Plugin Scripts
| Command | Description |
|---|---|
npm run plugins:generate | Regenerate plugin registry from manifests |
npm run plugins:watch | Watch plugin manifests and auto-regenerate |
Contribution Process
Step 1: Find Something to Work On
Browse our GitHub Issues to find something to work on:
Step 2: Create a Feature Branch
# Sync with upstream
git fetch upstream
git checkout main
git merge upstream/main
# Create a feature branch
git checkout -b feature/your-feature-name
Step 3: Make Your Changes
- Make your changes in the appropriate package
- Write tests for new functionality
- Run tests to ensure everything passes
- Update documentation if needed
Have questions? Ask in our Discord server - we're happy to help!
Step 4: Submit Your Pull Request
# Commit your changes
git add .
git commit -m "feat: add your feature description"
# Push to your fork
git push origin feature/your-feature-name
Then create a Pull Request on GitHub.
Step 5: After Your First PR is Merged
Congratulations!
After your first meaningful contribution is merged, you'll be:
- Added to our contributors list
- Eligible for deeper project discussions
- Welcome to schedule a call with maintainers if desired
- Considered for more significant responsibilities
Code Standards
General Guidelines
- TypeScript: All code must be in TypeScript with proper types
- Testing: New features must include tests
- Documentation: Public APIs must be documented
- Formatting: Use Prettier (runs automatically on commit)
- Linting: ESLint rules must pass
Commit Messages
We use conventional commit messages. Reference issue numbers when applicable.
feat: add new caching strategy
fix: resolve authentication bug (#123)
docs: update installation guide
test: add tests for plugin loader
Pull Request Checklist
Before submitting a PR, ensure:
- All tests pass (
npm test) - E2E tests pass (
npm run test:e2e) - Code is formatted (
npm run format) - Linting passes (
npm run lint) - Changes are documented if needed
- PR description explains the changes
- Related issue is referenced
Troubleshooting
Common Issues
Database Connection Errors
Error: Error: no such table: users
Solution:
# Run migrations
npm run db:migrate
# Verify migration status
wrangler d1 migrations list DB --local
Port Already in Use
Error: Error: listen EADDRINUSE: address already in use :::8787
Solution:
# Find and kill the process using port 8787
lsof -ti:8787 | xargs kill -9
Module Not Found / Import Errors
Error: Cannot find module 'hono'
Solution:
# Clear and reinstall dependencies
rm -rf node_modules package-lock.json
npm install
# Clear TypeScript build cache
rm -rf .wrangler
Build Failures
Error: Build fails when running npm run build:core
Solution:
- Ensure you're using Node.js 18+
- Clear build artifacts:
rm -rf packages/core/dist - Reinstall dependencies:
npm install - Try building again:
npm run build:core
Getting Help
Resources:
- π Full Documentation
- π GitHub Issues
- π¬ Discord
Ready to Contribute?
Questions?
If you have questions about contributing:
- Check existing issues - your question may already be answered
- Ask in Discord - for general questions
- Comment on the issue - for specific issue clarifications
We look forward to your contributions!