Getting Started
Learn how to set up and run your directory website in minutes
This guide will walk you through setting up Dirstarter. 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 18.x or later (we recommend using Node.js 20.x or later)
- Git (version control system)
- A package manager (npm, yarn, pnpm, or bun)
Quick Installation
Create a database
Dirstarter requires a Postgres database to work. Before creating your project, make sure to have created a new database and have the connection string ready. The Postgres connection string will look something like this:
We've covered some options for hosting your Postgres database in the database hosting guide.
Set up your project
There are many ways to download the source code of Dirstarter. We'll cover some of the most common ones below. Choose the one that best suits your needs.
Create a repository from the template
We recommend using the GitHub template to get started. When you visit the GitHub repository, you will see a "Use this template" button. Clicking on it will create a new repository with the Dirstarter project already set up. You will then be able to clone the repository and start working right away.
For more information on how to use the GitHub template, check out the GitHub documentation.
Benefits of Using GitHub Templates:
- Easy Distribution: Templates allow you to quickly create new repositories with the same structure and files as the boilerplate.
- Clean History: New repositories created from templates have unrelated histories, making them ideal for independent projects.
- Contribution Tracking: Commits to repositories created from templates are tracked in the contributor’s graph, unlike forks.
Once you have created a new repository from the template, you can clone the repository and start working right away.
Add upstream remote (optional)
If you want to be able to pull updates from the Dirstarter repository, you can add the upstream remote.
This will allow for an easier update process from the Dirstarter repository.
Set up environment variables
Dirstarter uses environment variables to configure the project. You can set them in the .env
file.
First, copy the .env.example
file to .env
to have a starting point.
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 page.
Initialize the database
Dirstarter uses Prisma to interact with the database. You can initialize the database by running the following command:
This will generate the Prisma client, migrate the database and seed it with the default data.
You can find more information about the database in the Prisma Setup page.
Start the development server
Now that you have the database set up, you can start the development server by running the following command:
This will start the development server on http://localhost:3000
. The website will be empty at this point, but we'll sort that out in the First Steps guide.
What's Next?
Now that you have Dirstarter running, here are some next steps:
Last updated on