Servercn Blueprint Contributing Guide
This guide explains how to contribute a Blueprint to Servercn. A Blueprint represents a high-level feature or application module (e.g., Auth, Payments, Inventory Management) that combines multiple components and patterns into a production-ready solution.
What Is a Blueprint?
A Blueprint in Servercn is:
- A complete, functional vertical feature
- Built on top of foundations
- Multi-database and multi-architecture by design
- Opinionated and production-ready
Includes:
- Business logic (Controllers, Services)
- Data models (Schemas/Models)
- Middleware specific to the feature
- Required environment variables
- Documentation for usage and integration
Unlike foundations which are base architectural layers, blueprints are feature-rich modules.
Some servercn blueprints:
Step-by-Step Contribution Guide
Fork & Clone the Repository
Fork the Servercn repository and clone it locally: GitHub Link
Add Registry
Each blueprint must follow the registry structure. Blueprints have a more nested structure because they support multiple databases and ORMs:
The example below references the registry structure for a blueprint:
I. $schema
- Points to the official Servercn blueprint schema.
- Ensures your configuration is validated automatically.
II. slug
- Unique identifier of the blueprint.
- Must be kebab-case.
- Used internally by CLI commands:
npx servercn-cli add bp my-blueprintIII. databases & orms
Blueprints are designed to be flexible. You should ideally provide implementations for:
- Databases: PostgreSQL, MySQL, MongoDB.
- ORMs: Drizzle (for SQL), Mongoose (for MongoDB).
IV. templates
Templates define the physical location of the code for each combination.
Template folder paths must exist inside:
packages/templates/node/express/blueprint/blueprint-name/database/orm/architecture/
Example:
Add Templates
Ensure your templates:
- Follow clean separation of concerns.
- Are production-ready with proper error handling and logging.
- Use components where possible instead of duplicating code.
Test the Blueprint via CLI
Before submitting:
npx servercn-cli add bp blueprint-name --local--local: Used for testing in the local environment.
Verify:
- No runtime errors during installation
- All files are correctly placed according to the architecture (MVC or Feature)
- Environment variables are correctly identified
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
- Outputs generated files into:
apps/web/public/sr/
Don't forget to run `npx servercn-cli build` before submitting your pull request.
Register in registry.json
Add your blueprint entry to:
apps/web/src/data/registry.json
Write Documentation
Add mdx documentation inside:
apps/web/src/content/docs/express/blueprints/blueprint-slug.mdx
Explain:
- Key features
- How the logic works
- Installation steps
- Environment variables required
Commit Properly
Use conventional commit format:
feat(blueprint): add blueprint-name blueprint
Submit a Pull Request
Your PR must include:
- Clear title and summary
- Supported databases and ORMs
- Verification that
npx servercn-cli buildwas run - Registry and template files
License
By contributing a blueprint to Servercn, you agree that your contribution will be licensed under the MIT License.
Thank you for contributing to Servercn blueprints 🚀 Your work helps developers build complex features in minutes.