treetag Svelte Themes

Treetag

Community tree tagging & adoption platform for the Charlton Kings Tree Guardian Project. Built with SvelteKit, MongoDB, and Leaflet.

🌳 Treetag

A community-driven web app for the Charlton Kings Tree Guardian Project. Discover, tag, adopt, and care for local trees through an interactive map and mobile-friendly interface.

Tech Stack

  • SvelteKit (Svelte 5) — fullstack framework
  • MongoDB + Mongoose — database & ODM
  • better-auth — authentication
  • shadcn-svelte + Tailwind CSS — UI components & styling
  • Leaflet + OpenStreetMap — interactive mapping
  • Cloudflare R2 — image storage
  • Docker — containerised deployment

Getting Started

Prerequisites

  • Bun (v1.2+)
  • MongoDB instance (local or remote)
  • Cloudflare R2 bucket (for image uploads)

Setup

# Install dependencies
bun install

# Copy env file and fill in your values
cp .env.example .env

# Start dev server
bun dev

Environment Variables

See .env.example for all required variables:

Variable Description
DATABASE_URL MongoDB connection string
BETTER_AUTH_SECRET Random secret for auth sessions
APP_URL Application URL (e.g. http://localhost:5173)
R2_ACCOUNT_ID Cloudflare account ID
R2_ACCESS_KEY_ID R2 API token access key
R2_SECRET_ACCESS_KEY R2 API token secret
R2_BUCKET_NAME R2 bucket name
R2_PUBLIC_URL Public URL for the R2 bucket

Scripts

bun dev        # Start development server
bun run build  # Build for production
bun run check  # Run svelte-check (TypeScript)
bun preview    # Preview production build

Docker

docker compose up --build

Project Structure

src/
ā”œā”€ā”€ lib/
│   ā”œā”€ā”€ components/ui/   # shadcn-svelte components
│   ā”œā”€ā”€ server/
│   │   ā”œā”€ā”€ auth.ts      # better-auth config
│   │   ā”œā”€ā”€ r2.ts        # Cloudflare R2 uploads
│   │   └── db/
│   │       ā”œā”€ā”€ index.ts # Mongoose connection
│   │       └── models/  # Tree, Observation, Photo, FAQ
│   ā”œā”€ā”€ auth-client.ts   # Client-side auth
│   └── utils.ts         # Shared utilities
ā”œā”€ā”€ routes/
│   ā”œā”€ā”€ auth/            # Login & register
│   ā”œā”€ā”€ trees/           # Browse, map, detail
│   ā”œā”€ā”€ faq/             # FAQ pages
│   └── api/auth/        # better-auth API handler
└── app.css              # Tailwind + theme variables

License

This project was built for the CT5038/DT5012 Agile Methods module at the University of Gloucestershire.

Top categories

Loading Svelte Themes