Project Shelf aims to give a space for developers to showcase their projects, get feedback and connect with other developers.
- Backend: Node.js, Pothos GraphQL, Prisma and Apollo Server
- Frontend: React.js, Next.js and Apollo Client
This monorepo contains
apps/api: Node.js app, provides all the apis and connects to the database.apps/web: Main app powered by Next.jsapps/admin: Next.js app for admin purposespackages/ui: Internal component library used by bothwebandadminapplicationspackages/apollo-hooks: Libary of apollo-graphql hooks generated by GraphQL Code Generator forwebandadminapp to consume
-
- Yarn
This repository uses Yarn as a package manager.
-
-
PostgreSQL Database
To run the backend, a connection to a database is needed. The easiest way to run a Postgres DB locally is via Docker.
Once you have Docker installed run this command:
docker run --detach --publish 5432:5432 -e POSTGRES_PASSWORD=postgres --name project-shelf postgres:10.12Another alternative is running a PostgreSQL DB in the cloud with services like fly.io wich have a a free tier.
-
Cloudinary
All the images are saved in Cloudinary, the free tier is more than enough for development.
-
Enviroment Variables
Inside the
apps/apidirectory# Database connection string, if running with docker it would be: DATABASE_URL="postgresql://postgres:postgres@localhost:5432/project-shelf" # Direct url, if running with docker it would be: DIRECT_URL="postgresql://postgres:postgres@localhost:5432/project-shelf" # Origins, you can use the default one ORIGINS=["http://localhost:3000", "http://localhost:4000"] # Cloudinary connection string, you can get it from your cloudinary account CLOUDINARY_URL="Your Cloudinary key goes here" # JWT secret, any random string, only for development JWT_SECRET="Any random string, only for development" # Server url, you can use the default one SERVER_URL="http://localhost"
-
-
-
Github OAuth Github is being used as an auth provider, you will need to create an OAuth app on your github account with these settings:
-
Enviroment Variables
Inside the
apps/webandapps/admindirectories# Github client id, you can get it from your github account GITHUB_CLIENT_ID="your oatuh github client id" # Github client secret, you can get it from your github account GITHUB_CLIENT_SECRET="your oatuh github client secret" # JWT secret, any random string, only for development JWT_SECRET="some random string, only for development" # Next auth url, you can use the default one NEXTAUTH_URL="http://localhost:3000" # Next public server url, you can use the default one NEXT_PUBLIC_SERVER_URL="http://localhost:8080/graphql" NEXT_PUBLIC_CLOUD_NAME="cloudinary id"
-
-
-
Build the hooks library
yarn build:hooks -
Install all dependencies, on the root folder run
yarn install
-
-
- Make sure you cd into the project-shelf/apps/api directory
- Generate data source client code with prisma
npx prisma generate- Initialize Database
npx prisma migrate dev- Run app
yarn dev:api -
-
Start the app
yarn dev:web -
(optional) inside the apps/web, use the
yarn generatecli command to generate templates for pages and components.
-
- To update the schema on the frontend
yarn generate:hooksyarn build:hooks
The easiest way to run the entire application is using Docker. This setup includes all services in a single container plus a PostgreSQL database.
# Start everything with setup script (recommended)
./scripts/docker-setup.sh
# Or use Make commands
make dev-build
# Or use Docker Compose directly
docker compose up -d --buildOnce you've completed the initial setup, you can start the app with:
# Start all services
docker compose up -d
# Or use Make
make dev
# Stop services
docker compose down
# Or
make dev-downAll services run in one container:
- Web Frontend: http://localhost:3000
- Admin Dashboard: http://localhost:4000
- API: http://localhost:8080
- Database: localhost:5432
# View logs
make dev-logs
# Stop services
make dev-down
# Database commands
make db-studio # Open Prisma Studio
make db-migrate # Run migrations
make db-seed # Seed database
# Clean up
make cleanThe Docker setup includes:
- ✅ All monorepo packages (ui, apollo-hooks, etc.)
- ✅ All apps (web, admin, api)
- ✅ Hot reloading for all services
- ✅ Package building and linking
- ✅ Automatic database setup (migrations and seeding)
# Rebuild everything
docker compose build --no-cache
# View container logs
docker compose logs -f app
# Access container shell
docker compose exec app sh