discordpreviews.com
The source code for the Discord Previews website.
Setup
Development Setup
- Install dependencies via
npm install
- Use Docker Compose to run a database via
docker-compose up -d
, unless you already have a local PostgreSQL database running. - Copy the default
.env.example
file to.env
. If you are using Docker Compose, you can leave everything in that file as-is, otherwise edit it to match your local environment. - Push the Prisma schema to the database via
npx prisma db push
- Start the development server via
npm run dev
Production Setup
- Install dependencies via
npm install
- Copy the default
.env.example
file to.env
. In production you should have a database running locally, so you will need to edit the.env
accordingly. Additionally, if you don't want debug logging, you will need to addNODE_ENV=production
in the.env
file. - Apply database migrations via
npx prisma migrate deploy
- Build the production server via
npm run build
- Start the production server via
npm run start
Adding an article
Currently adding an article can only be done via the database, though there are plans to add UI for it on the frontend in the future. To add an article, connect to the database and run the following query:
INSERT INTO public."NewsArticle" (slug, content, tags, published)
VALUES ('example', '---
title: Example Article
description: Example Description
---
The content of your news article.', '{keywords,for,seo}', '<ISO 8601 Timestamp>');
If you don't want the article to be shown on the front page, you can simply set the published
field to null
. Then it will only be accessible via by directly accessing the URL.