LogoMkSaaS Docs

Getting Started

Learn how to set up and run your directory website in minutes

This guide will walk you through setting up MkSaaS. We will go through the process of cloning the project, installing dependencies, setting up your database and running the local development server.

Prerequisites

Before you begin, make sure you have the following installed:

Node.js

Node.js is a runtime environment that allows you to run JavaScript code.

If you don't have Node.js installed, download it from the Node.js official website.

# Check if Node.js is installed
node -v

Git

Git is a version control system that is used to track changes in any set of files.

If Git is not installed, download it from the Git official website.

# Check if Git is installed
git --version

Package manager

Package manager is a tool that is used to manage dependencies in your project.

We recommend using pnpm, but you can use npm, yarn or bun as well.

# Install pnpm if you haven't already
npm install -g pnpm
 
# Check pnpm version
pnpm --version

Quick Installation

Set up your project

There are many ways to download the source code of MkSaaS. We'll cover some of the most common ones below. Choose the one that best suits your needs.

We recommend forking the GitHub repository to get started.

When you visit the GitHub repository, you will see a "Fork" button in the top right corner. Clicking on it will create a copy of the MkSaaS repository in your GitHub account, please keep this repository private.

Once you have forked the repository, you can clone your fork to your local machine:

git clone https://github.com/your-username/mksaas-template.git your-project-name
 
cd your-project-name

Benefits of forking the repository

  • Full History: You maintain the full commit history of the project.
  • Easy Updates: You can easily pull updates from the original repository using pull requests.
  • Contribution Ready: If you want to contribute, your fork is already set up for that.

If you want to be able to pull updates from the MkSaaS template repository, you can add the upstream remote, this will allow for an easier update process from the MkSaaS repository.

git remote add upstream https://github.com/MkSaaSHQ/mksaas-template.git

Install dependencies

Install the dependencies by running the following command:

pnpm install

Create a database

MkSaaS requires a Postgres database to work. Before creating your project, make sure to have created a new database and have the connection string ready.

We've covered some options for hosting your Postgres database in the Database Setup guide, for example, using Neon or Supabase.

The Postgres connection string will look something like this:

postgresql://user:password@host:port/database

Set up environment variables

MkSaaS uses environment variables to configure the project. You can set them in the .env file, so first copy the .env.example file to .env to have a starting point.

cp .env.example .env

Then, open the .env file and set the variables to your desired values. You can find more information about the environment variables in the Environment Setup guide.

Initialize the database

MkSaaS uses Drizzle ORM to interact with the database. You can initialize the database by running the following command:

pnpm run db:generate # Generate the Drizzle client
pnpm run db:migrate # Migrate the database

This will generate the Drizzle client, and migrate the database.

You can find more information about the database in the Database Integration guide.

Start the development server

Now that you have the database set up, you can start the development server by running the following command:

pnpm run dev

This will start the development server on http://localhost:3000.

Next Steps

Now that you have MkSaaS running, here are some next steps:

Table of Contents