Skip to content
hoangm960Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

207 Commits

Folders and files

Repository files navigation

Snuggle

A full-stack pet adoption platform where users can browse, list, and adopt pets.

Description

Snuggle is a pet adoption platform built with Next.js and Express.js. Users can browse available pets, apply for adoption with eKYC identity verification, sign digital adoption contracts, chat with shelters in real time, and manage their profiles. The platform uses Firebase for authentication and Firestore for data storage.

For tech stack and folder structure, see SPEC.md.

Setup

Prerequisites

  • Node.js 18+
  • Yarn
  • Firebase project

1. Clone and Install Dependencies

# Install frontend dependencies
cd frontend
yarn install

# Install backend dependencies
cd ../backend
yarn install

# Setup Git hooks (optional)
cd backend
yarn prepare

2. Configure Firebase

Create a Firebase project at console.firebase.google.com:

  1. Enable Authentication (Email/Password provider)
  2. Enable Firestore Database
  3. Create a service account and download the private key

3. Environment Variables

Frontend (.env.local)

NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
NEXT_PUBLIC_API_URL=http://localhost:3001/api

Backend (.env)

FIREBASE_API_KEY=your-firebase-key
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_SERVICE_ACCOUNT_FILE=./firebase-service-key.json
PORT=3001
NODE_ENV=development

SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=[email protected]
SMTP_PASS=your-app-password
SMTP_FROM=Snuggles [email protected]

Note: Create a service account in Firebase Console and download the JSON key. Place it in the backend/ directory and rename it to firebase-service-key.json (or update the path in FIREBASE_SERVICE_ACCOUNT_FILE).

Specification

See SPEC.md for detailed system specifications, database schema, and feature documentation.

4. Run Development Servers

# Terminal 1 - Backend
cd backend
yarn dev

# Terminal 2 - Frontend
cd frontend
yarn dev

Lint & Format

# Frontend
cd frontend
yarn lint           # ESLint (zero warnings allowed)
yarn format         # Prettier

# Backend
cd ../backend
yarn lint           # ESLint on src/
yarn format         # Prettier

Testing

Firebase is fully mocked — no real Firebase project needed for tests.

Test Commands

# Frontend
cd frontend
yarn test               # Vitest
yarn test -- file.test  # Single test file

# Backend
cd ../backend
yarn test               # Jest (30s timeout)
yarn test -- file.test  # Single test file
yarn test:watch         # Watch mode
yarn test:coverage      # With coverage

API Reference

See SPEC.md for full API documentation including request/response examples and error codes.

Building for Production

# Build frontend
cd frontend
yarn build

# Build backend
cd ../backend
yarn build
yarn start

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages