Source • New features • Installing
Extended from Ben Awad's Fullstack Tutorial.
These are features implemented beyond the tutorial.
- Subreddits
- Comments
- Sorting on top or new
- User image upload
This project is hosted as a monorepo, storing both the frontend and the backend in one repository. Some setup is needed for both parts of the project.
To install packages:
yarn
Install PostgreSQL
Create a database
createdb lireddit_cees
Install Redis
Copy and paste .env.example to .env and insert the following values:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/lireddit_cees
REDIS_URL=127.0.0.1:6379
PORT=4000
SESSION_SECRET=[insert a long random string here]
CORS_ORIGIN=http://localhost:3000
Run tsc
yarn watch
In another window, run the server (view on localhost:4000/graphql)
yarn dev
- A simple but effective trick is: stop
yarn watch
, remove thedist
folder, then runyarn watch
again. - Check if the migrations ran properly.
- After running migrations, you may need to remove the migration files in
server/migrations
.
To install packages:
yarn
Copy and paste .env.local.example to .env.local and insert the following values:
NEXT_PUBLIC_API_URL=http://localhost:4000/graphql
To run the server (view on localhost:3000)
yarn dev