Skip to content

C4G/paladin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paladin Farm & Ranch

Introduction

Paladin Farm & Ranch is a Computing for Good (C4G) project built to support farmers and ranchers in disaster preparedness and recovery. The application allows users to register their farms, manage crops, livestock, and equipment, submit disaster assistance requests, and coordinate responses from volunteers. The production application is deployed at paladinfarmandranch.com.

User Features

Feature Description
Farm & Ranch Management Register farms with geolocation, gates, crops, livestock, equipment, and emergency needs
Disaster Requests Create and coordinate disaster assistance requests and volunteer responses
Dashboard Overview of active requests and farm data
Disaster Resources Admin-managed list of helpful links and resources
Push Notifications Web push notification support for subscribed users
Google Maps Interactive maps for farm and gate locations
Contact Form Public contact submission form
User Management Admin page for managing users. Base roles are ADMIN and STAFF

Developer Features

Feature Description
Authentication Google OAuth login with 2 provided test accounts
CI/CD Automatic deployment of the application and DB

Getting Started

  1. Make sure you have the following set up and configured on your computer:
  2. Clone the repo using either SSH, HTTPS, or Github Desktop
  • SSH
git clone git@github.com:C4G/paladin.git
  • HTTPS
git clone https://github.com/C4G/paladin.git
  1. Get the .env file from the project mentor. This file contains secrets for authentication, database connection, Google Maps API keys, and push notification keys. Contact the project mentor to get the contents of this file. Do not commit this file to version control.
  2. Install all of the node dependencies with the following command
pnpm install
  1. Make sure you have docker running and run the following command to initialize the database, apply all database schema, and seed some test users:
pnpm run init
  1. If all is well up to this point your terminal should look like this: Initialization Successful
  2. Next, run the development server
pnpm run dev

Open http://localhost:3000 with your browser to see the result.

  1. You may login with either of the accounts below or with your own gmail account
Username Password Role
c4gdevad@gmail.com EHdqcGJajTAnSy$8 ADMIN
c4gdevstaff@gmail.com JCbSk3&&JF!h#m@x STAFF
  1. To access the database you can run the following command in a new terminal:
pnpm exec prisma studio

It should open the browser automatically or you can open http://localhost:5555/ to see the database tables.

You can start editing the page by modifying src/app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Technologies Used

Production Deployment

The application uses Docker Compose for production, following the C4G template pattern: a Postgres database, a one-shot migration container, and the Next.js standalone app.

Architecture

  • Database (paladin-db): PostgreSQL 17 with a persistent volume.
  • Migrations (paladin-migrations): runs prisma migrate deploy once, then exits.
  • Application (paladin-app): Next.js standalone server, starts only after migrations succeed. Exposes a health endpoint at /api/health.

Commands

# Build and start all services
docker compose --profile production up -d --build

# Check status / logs
docker compose ps
docker compose logs paladin-app
docker compose logs paladin-migrations

# Stop (and clean) the stack
docker compose --profile production down
docker compose --profile production down --volumes --remove-orphans

All required variables must be set in .env before deploying — see .env.prod.example. NEXT_PUBLIC_* variables are baked into the client bundle at build time and are passed as Docker build args (see docker-compose.yml).

C4G staff / TA setup (out of repo)

These steps are performed once per project by C4G staff and are not automated in this repository:

  1. GitHub Actions secrets — add repo/org secrets used by .github/workflows/ci.yaml: DATABASE_PW, DATABASE_USER, DATABASE_NAME, DATABASE_HOST, AUTH_SECRET, AUTH_GOOGLE_ID, AUTH_GOOGLE_SECRET, RESEND_API_KEY, NOTIFICATION_EMAIL, NEXT_PUBLIC_VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY, NEXT_PUBLIC_GOOGLE_MAPS_API_KEY, PAYPAL_CLIENT_ID, PAYPAL_PLAN_ID, PAYPAL_SECRET, PAYPAL_API_BASE.
  2. Google OAuth — configure the OAuth client and authorized redirect URIs in GCP for the project subdomain.
  3. Server .env — place the production .env on the c4g.dev server (values for the variables in .env.prod.example).
  4. nginx + SSL — add the nginx vhost for the project subdomain and (re)issue the SSL certificate.
  5. Deploy — on the server, run docker compose --profile production up -d --build.

About

Paladin Farm & Ranch — Computing for Good (C4G) project: Next.js + Prisma + Postgres, deployed via Docker Compose.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors