https://github.com/dammy001/express-ts-starter
https://github.com/dammy001/express-ts-starter
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dammy001/express-ts-starter
- Owner: dammy001
- Created: 2023-08-26T07:58:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-01T09:16:12.000Z (about 2 months ago)
- Last Synced: 2025-04-01T10:25:45.645Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 520 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About the Project
### Built With
- [ExpressJS](https://nextjs.org/)
- [PostgreSQL](https://www.postgresql.org/)
- [TypeScript](https://www.typescriptlang.org/)
- [Prisma.io](https://prisma.io)## Getting Started
To get a local copy up and running, please follow these simple steps.
### Prerequisites
Here is what you need to be able to run the project.
- Node.js (Version: >=18.x)
- PostgreSQL
- pnpm _(recommended)_> If you want to enable any of the available integrations, you may want to obtain additional credentials for each one. More details on this can be found below under the [integrations section](#integrations).
## Development
### Setup
1. Clone the repo into a public GitHub repository (or fork https://github.com/dammy001/express-ts-starter/fork).
```sh
git clone https://github.com/dammy001/express-ts-starter.git
```> If you are on windows, run the following command on `gitbash` with admin privileges:
> `git clone -c core.symlinks=true https://github.com/dammy001/express-ts-starter.git`1. Go to the project folder
```sh
cd express-ts-starter
```1. Install packages with pnpm
```sh
pnpm i
```1. Set up your `.env` file
- Duplicate `.env.example` to `.env`
- Use `openssl rand -base64 32` to generate a key and add it under `SECRET_KEY` in the `.env` file.#### Quick start with `pnpm docker:compose`
> - **Requires Docker and Docker Compose to be installed**
> - Will start a local Postgres and Redis instance with a few test users.```sh
pnpm docker:compose
```#### Manual setup
1. Configure environment variables in the `.env` file. Replace ``, ``, ``, and `` with their applicable values
```
DATABASE_URL='postgresql://:@:'
```
If you don't know how to configure the DATABASE_URL, then follow the steps here to create a quick local DB1. [Download](https://www.postgresql.org/download/) and install postgres in your local (if you don't have it already).
2. Create your own local db by executing `createDB `
3. Now open your psql shell with the DB you created: `psql -h localhost -U postgres -d `
4. Now extract all the info and add it to your DATABASE_URL. The url would look something like this
`postgresql://postgres:postgres@localhost:5432/Your-DB-Name`.
1. Set up the database using the Prisma schema (found in `packages/prisma/schema.prisma`)
In a development environment, run:
```sh
pnpm db:migrate
```In a production environment, run:
```sh
pnpm db:deploy
```1. Run (in development mode)
```sh
pnpm run dev
```#### Setting up your first user
1. Open [Prisma Studio](https://prisma.io/studio) to look at or modify the database content:
```sh
pnpm run db:studio
```1. Click on the `User` model to add a new user record.
1. Fill out the fields `email`, `userName`, `firstName`, `lastName` and click `Save 1 Record` to create your first user.
> You might want to adjust this behavior to your needs in the `prisma/schema.prisma` file.### E2E-Testing
```sh
# In a terminal just run:
pnpm test
```