You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

create-mvc-server

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-mvc-server

A CLI tool to quickly scaffold a server with a database of your choice

1.1.2
Source
npmnpm
Version published
Weekly downloads
2
-80%
Maintainers
0
Weekly downloads
 
Created
Source

Create MVC Server

The core logic is implemented in packages/create-mvc/src/index.ts and provides an interactive way to scaffold a new MVC server for your project.

Available Options

The tool supports the following configuration options:

  • Server Framework

    • Express
    • Hono (PostgreSQL only)
  • Database

    • PostgreSQL
    • MongoDB
    • MySQL
    • SQLite
  • Language

    • JavaScript
    • TypeScript

Usage

You can use the tool in two ways:

  • Interactive Mode
npx create-mvc
  • Template Mode
npx create-mvc --template <template-name>

Command Line Options

Usage: create-mvc [options] [project-name]

Options:
  -t, --template NAME        Use a specific template
  -h, --help                Display this help message

Available Templates

The following templates are available:

  • pg-ts: Express + PostgreSQL + TypeScript
  • pg: Express + PostgreSQL + JavaScript
  • mongo-ts: Express + MongoDB + TypeScript
  • mongo: Express + MongoDB + JavaScript
  • mysql-ts: Express + MySQL + TypeScript
  • mysql: Express + MySQL + JavaScript
  • sqlite-ts: Express + SQLite + TypeScript
  • sqlite: Express + SQLite + JavaScript
  • hono-pg-ts: Hono + PostgreSQL + TypeScript
  • hono-pg: Hono + PostgreSQL + JavaScript

Features

  • Interactive CLI prompts for project configuration
  • Git repository initialization option
  • Automatic package name validation
  • Smart template selection based on chosen options
  • Support for multiple package managers (npm, yarn)
  • Directory conflict resolution
  • Automatic file renaming (e.g., _gitignore → .gitignore)

Project Structure

The generated project will include:

  • Basic server setup with chosen framework
  • Database configuration
  • Type definitions (for TypeScript projects)
  • Basic routing structure
  • Error handling middleware
  • Environment configuration
  • Testing setup

Example

# Create a new project with interactive prompts
npx create-mvc my-server

# Create a new project using a specific template
npx create-mvc my-server --template pg-ts

After project creation, follow the printed instructions to:

  • Navigate to the project directory
  • Install dependencies
  • Start the development server

Database Setup

Depending on your chosen database, you'll need to:

PostgreSQL

  • Install PostgreSQL locally or use a cloud service (e.g., AWS RDS, DigitalOcean)
  • Set up connection details in your .env file:
    DATABASE_URL=postgresql://user:password@localhost:5432/dbname
    

MongoDB

  • Install MongoDB locally or use MongoDB Atlas
  • Set up connection details in your .env file:
    MONGODB_URI=mongodb://localhost:27017/dbname
    

MySQL

  • Install MySQL locally or use a cloud service
  • Set up connection details in your .env file:
    DATABASE_URL=mysql://user:password@localhost:3306/dbname
    

SQLite

  • No additional installation required
  • Set up database path in your .env file:
    DATABASE_URL=file:./dev.db
    

Deployment

The generated server can be deployed to various platforms:

  • Supabase: Supports PostgreSQL, MongoDB, MySQL, and SQLite
  • Heroku: Supports all database options
  • Vercel: Works well with Serverless deployment (especially Hono)
  • DigitalOcean: Supports all database options
  • AWS: Can be deployed to EC2, ECS, or Lambda
  • Railway: Excellent for both application and database hosting

Remember to:

  • Set up appropriate environment variables
  • Configure your database connection string
  • Set up proper security measures (e.g., SSL, firewalls)

Keywords

cli

FAQs

Package last updated on 20 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts