Servercn Foundation Contributing Guide
This guide explains how to contribute a Foundation to Servercn. A foundation represents a production-ready backend baseline (database, logging, security, env setup, tooling, etc.) that other foundations build upon.
What Is a Foundation?
A Foundation in Servercn is:
- A complete backend starting structure
- Opinionated but extensible
- Runtime + framework scoped
Includes:
- Templates (project structures)
- Runtime dependencies
- Dev dependencies
- Required environment variables
It is not a single feature — it is the base architecture layer.
Some servercn foundations:
Step-by-Step Contribution Guide
Fork & Clone the Repository
Fork the Servercn repository and clone it locally: GitHub Link
Add Registry
Each foundation must follow the registry structure:
The example below references the demo foundation:
I. $schema
- Points to the official Servercn foundation schema.
- Ensures your configuration is validated automatically.
- If this is missing or incorrect, the foundation will fail validation.
- Always use the official schema URL.
II. slug
- Unique identifier of the foundation.
- Must be kebab-case.
- Used internally by CLI commands:
npx servercn-cli add fd express-starterIII. runtimes
Defines which runtime environments support this foundation.
- Currently, node is the primary runtime.
- Future runtimes (e.g., bun, deno) may be added.
- Your foundation must not assume compatibility with unsupported runtimes.
IV. frameworks
Specifies which frameworks the foundation supports.
- Only define frameworks your templates actually support.
- If you declare express, you must provide valid Express-compatible templates.
- Do not declare frameworks without implementation support.
V. dependencies
Defines packages automatically installed when the foundation is added.
- Only include packages required by your templates.
- Do not include unnecessary peer dependencies.
VI. templates
Templates define project structure variants.
- If you declare both, you must implement both.
- Template folder paths must exist inside:
-
packages/templates/node/express/foundation/new-foundation/
Example:
VII. env
Defines required environment variables.
- Only include truly required variables.
- Use clear naming conventions.
- Avoid default secrets inside templates.
- No hardcoded credentials.
Add Templates
Template must follow the folder structure below:
- Follow clean separation of concerns
- Match selected architecture style
- Avoid unnecessary dependencies
- Be production-ready
Test the Component via CLI
Before submitting:
npx servercn-cli add fd foundation-name --local--local: Used for testing in the local environment.
Verify:
- No runtime errors
- Files generate correctly
- Architecture mapping works
- Stack selection works
Build the Registry Items
Before opening your pull request, ensure the registry output is generated and up to date.
npx servercn-cli buildWhat This Does:
- Compiles all registry items
- Validates schema structure
- Processes component metadata
- Outputs generated files into:
apps/web/public/sr/
Verification:
- After running the build command:
- Navigate to
apps/web/public/sr/ - Confirm your component/item appears
- Ensure generated JSON reflects your changes
Only proceed with your pull request after confirming the registry output is correct.
Don't forget to run `npx servercn-cli build` before submitting your pull request to ensure the registry output is up to date.
Register in registry.json
Add registry inside:
apps/web/src/data/registry.json
This configuration is used to generate the docs sidebar and display foundations in the
/foundationsroute.
Write Minimal Documentation
Add mdx documentation inside:
apps/web/src/content/docs/express/foundations/foundation-slug.mdxKeep documentation concise and technical.
Don't forget to include `mvc_structure` and `feature_structure` in the front matter.
Validation Checklist Before PR
- Slug is unique
- Schema URL correct
- Templates exist physically
- Dependencies match imports
- No unused packages
- Type definitions installed
- Foundation builds without errors
Commit Properly
Use conventional commit format:
feat(foundation): add foundation-name foundation
Example:
feat(foundation): add drizzle-pg-starter for node/express with mvc and feature architecture
Submit a Pull Request
Your PR must include:
- Clear title
- Foundation summary
- Supported stacks
- Testing confirmation
- Foundation registry entry
- Template directories
License
By contributing a foundation to Servercn, you agree that your contribution will be licensed under the MIT License.
Thank you for contributing to Servercn foundation 🚀 Your work helps strengthen the Node.js backend ecosystem.