Back to Documentation

Getting Started

Install ServCraft and create your first project in minutes

ServCraft is a modular Node.js backend framework that helps you build production-ready APIs quickly. Generate clean, maintainable code with built-in best practices.

Why ServCraft?

Built for developers who want clean, maintainable code without sacrificing flexibility or performance.

Production Ready

Generate backend code that's ready for production with best practices baked in.

Modular Architecture

Organize your code in self-contained modules that are easy to maintain and test.

Secure by Default

Built-in authentication, authorization, rate limiting, and security headers.

High Performance

Powered by Fastify for blazing fast request handling and low latency.

System Requirements

Node.js 18+ installed
npm, yarn, or pnpm
A code editor (VS Code recommended)
Git for version control

Installation Steps

Follow these steps to get ServCraft up and running

01

Install ServCraft CLI

Install ServCraft globally on your system using npm. This gives you access to the servcraft command-line tool for creating and managing projects.

npm install -g servcraft

The CLI includes all the tools you need to generate code, manage modules, and run development servers.

02

Verify Installation

Check that ServCraft is installed correctly and see the installed version.

servcraft --version

You should see something like: ServCraft v0.4.9

03

Create a New Project

Initialize a new project with interactive setup. The CLI will guide you through choosing your preferences.

servcraft init my-app

You'll be prompted to select: TypeScript/JavaScript, database provider (PostgreSQL, MySQL, etc.), validator library, and module system.

04

Navigate to Project

Change into your new project directory.

cd my-app

All subsequent commands should be run from this directory.

05

Install Dependencies

Install all project dependencies defined in package.json.

npm install

This installs Fastify, Prisma, and all other dependencies your project needs.

06

Setup Database

Initialize the database and push the schema. For development, this is all you need.

npm run db:push

For production, use migrations: npm run db:migrate

07

Start Development Server

Start the development server with hot reload. Your code changes will automatically restart the server.

npm run dev

Your API will be available at http://localhost:3000

All-in-One Setup

Run these commands to get started quickly

Complete Setup
1# Complete setup in one go npm install -g servcraft servcraft init my-awesome-api cd my-awesome-api npm install npm run db:push npm run dev # Your API will be available at http://localhost:3000

Project Templates

Choose a template that fits your needs

Minimal

Basic API structure with core files only. Perfect for simple projects or learning.

servcraft init my-api --template minimal
Fastify setup
Basic Prisma schema
Error handling
No modules

Full Stack

Complete setup with auth, users, and common modules. Best for production applications.

servcraft init my-app --template full
JWT Authentication
User management
Email module
Rate limiting

Microservice

Lightweight setup for microservices. Minimal dependencies, focused on performance.

servcraft init my-service --template microservice
Minimal files
Fastify native
No ORM overhead
Docker-ready

CLI Options

Customize your project setup with these options

--ts
Use TypeScript (default)(default: )
--js
Use JavaScript instead of TypeScript
--prisma <db>
Database: postgres, mysql, sqlite, mongodb(default: postgres)
--validator <lib>
Validator: zod, joi, yup(default: zod)
--esm
Use ESM modules (.js)
--cjs
Use CommonJS modules (.js/.cjs)
--template <name>
Project template: minimal, full, microservice
--force
Overwrite existing directory
--dry-run
Preview changes without creating files

Troubleshooting Common Issues

Command not found: servcraft

Solution: Make sure npm global modules are in your PATH. Try: npm config get prefix and add that to your PATH.

Permission denied when installing

Solution: Use sudo npm install -g servcraft (Linux/Mac) or run as Administrator (Windows).

Database connection failed

Solution: Check your DATABASE_URL in .env. Make sure your database server is running.

Port 3000 already in use

Solution: Set a different PORT in your .env file or stop the other process using the port.