Part of the Archer Life Suite — A comprehensive health and wellness platform for calorie tracking, meal logging, and nutrition management.
Archer Health is a modern web application built with Next.js 15, offering nutrition tracking with over 10,000 foods, goal setting, progress analytics, and recipe discovery. It integrates verified USDA FoodData Central nutrition information for accurate calorie and nutrient calculations and TheMealDb for recipes.
Download the latest USDA FoodData Central CSV files from USDA FoodData Central.
git clone https://github.com/AD-Archer/archer-health.git
cd archer-health
pnpm installExtract and place the CSV files in the data/ folder. The folder should be named with the date, e.g., data/FoodData_Central_csv_2025-04-24/.
cp .env.example .env
# Edit .env with your configuration (see Environment Setup section below)docker-compose up -d
npx prisma migrate devThe seeding process imports 2+ million foods and takes approximately 24 hours. Use tmux or screen to prevent the process from stopping if your connection drops:
tmux new -s seeding
npx prisma db seed
# Detach with Ctrl+B D, reattach with tmux attach -t seedingAfter seeding completes, you have two options:
Option A: Delete repo and use Docker image
# After seeding, you can delete the repo
rm -rf archer-health
# Run the pre-built Docker image
docker run -d \
--name archer-health \
-p 3000:3000 \
--env-file .env \
adarcher/archer-health:latestOption B: Build and run locally
pnpm run build
pnpm run dev- Application: http://localhost:3000
- Health Check: http://localhost:3000/api/health
Create a .env file with the following required variables:
# Database Configuration
DATABASE_URL="postgresql://postgres:your_secure_password@db:5432/archer_health_db"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_your_clerk_publishable_key"
CLERK_SECRET_KEY="sk_test_your_clerk_secret_key"
# Email/SMTP Configuration (for contact forms)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_SECURE="false"
SMTP_USER="[email protected]"
SMTP_PASS="your-app-password"
SMTP_FROM="[email protected]"
CONTACT_EMAIL="[email protected]"
# Caching (Redis)
REDIS="redis://user:password@host:6379/0"
# Optional namespace for keys (matches Redis ACL patterns)
REDIS_KEY_PREFIX="archer-health"
# Optional TTL override in seconds (defaults to 300)
CACHE_TTL_SECONDS="300"The application uses PostgreSQL. You can run it via Docker Compose or connect to an existing PostgreSQL instance.
- Create a Clerk account
- Create a new application
- Copy the publishable key and secret key to your
.envfile - Configure your OAuth providers and redirect URLs
The contact form requires SMTP configuration. For Gmail:
- Enable 2-factor authentication
- Generate an App Password
- Use your Gmail address as
SMTP_USER - Use the App Password as
SMTP_PASS
Redis is used to cache frequently requested nutrition and profile data, reducing Prisma load and speeding up responses. Provide a REDIS (or REDIS_URL) connection string in .env; the app safely falls back to live database queries if Redis is unreachable. Set REDIS_KEY_PREFIX if your Redis user has an ACL key pattern (for example ~archer_health_user:*), and tune cache freshness via CACHE_TTL_SECONDS (default 5 minutes).
For local development with full source code access:
# Clone the repository
git clone https://github.com/AD-Archer/archer-health.git
cd archer-health
# Install dependencies
pnpm install
# Start PostgreSQL database
docker-compose up -d
# Run database migrations
npx prisma migrate dev
# Seed USDA data (optional, takes several minutes)
npx prisma db seed
# Start the development server
pnpm devversion: '3.8'
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: archer_health_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
archer-health:
image: adarcher/archer-health:latest
container_name: archer-health
ports:
- "3000:3000"
env_file:
- .env
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
restart: unless-stopped
volumes:
postgres_data:# Pull the latest image
docker pull adarcher/archer-health:latest
# Run with environment variables
docker run -d \
--name archer-health \
-p 3000:3000 \
-e DATABASE_URL="postgresql://..." \
-e NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..." \
-e CLERK_SECRET_KEY="sk_test_..." \
adarcher/archer-health:latest# Clone and build
git clone https://github.com/AD-Archer/archer-health.git
cd archer-health
# Build the image
docker build -t archer-health .
# Run the container
docker run -d \
--name archer-health \
-p 3000:3000 \
--env-file .env \
archer-healthArcher Health integrates verified USDA FoodData Central nutrition information for accurate calorie and nutrient calculations.
- 2+ million foods with verified nutritional information
- Complete nutrient profiles (proteins, carbs, fats, vitamins, minerals)
- Food categories and serving size data
- All data sourced from USDA's official FoodData Central database
- Current dataset:
data/FoodData_Central_csv_2025-04-24/ - Includes: food.csv, nutrient.csv, food_nutrient.csv, food_portion.csv, etc.
- Data is updated annually with new USDA releases
The database includes two main data categories:
- User Data: Custom foods, meals, goals, achievements (user-generated)
- USDA Data: Verified nutritional information (pre-seeded)
Tables are designed to be modular - USDA data can be updated independently of user data.
When new USDA data is released:
# 1. Download new CSV files from USDA FoodData Central
# 2. Replace contents of data/FoodData_Central_csv_2025-04-24/
# 3. Update folder name in seed script if needed
# 4. Re-run seeding
npx prisma db seedNote: Seeding is non-destructive and idempotent - user data remains untouched.
- Health Check:
GET /api/health- Application health status - Authentication: Clerk-managed authentication endpoints
- Nutrition Data: USDA FoodData Central integration
- User Management: Profile, goals, and progress tracking
- ✅ Nutrition Tracking: Calorie counting with USDA-verified data
- ✅ Meal Logging: Comprehensive meal and food entry system
- ✅ Goal Setting: Personalized nutrition and fitness goals
- ✅ Progress Analytics: Charts and insights for tracking progress
- ✅ Recipe Discovery: Recipe database with nutritional information
- ✅ User Authentication: Secure authentication via Clerk
- ✅ Responsive Design: Mobile-first design for all devices
- ✅ Health Checks: Built-in monitoring and health checks
- Frontend: Next.js 15, React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, Prisma ORM
- Database: PostgreSQL
- Authentication: Clerk
- Deployment: Docker, Docker Compose
- Email: SMTP integration for contact forms
- Repository: https://github.com/AD-Archer/archer-health
- Docker Image: https://hub.docker.com/repository/docker/adarcher/archer-health
- Issues: https://github.com/AD-Archer/archer-health/issues
This project is part of the Archer Life Suite. See LICENSE file for details.
