Skip to content

πŸ‘‰ Backend API for the Garden Almanac MERN app β€” Node.js + Express with MongoDB for storing garden entries and user data.

Notifications You must be signed in to change notification settings

daidensacha/almanac-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Garden Almanac

Mockup

Garden Almanac is a full-stack project consisting of a React frontend (almanac-client) and a Node/Express backend (almanac-server) powered by MongoDB. It helps track plants, categories, events, and seasonal tips β€” with extras like Unsplash image integration and email-based authentication.


Project Structure

  • almanac-client β†’ React frontend
  • almanac-server β†’ Express + MongoDB backend
  • almanac-shared β†’ Shared constants and helpers (password rules, validation, etc.)

Features

  • 🌱 JWT-based authentication (signup with email activation, login, forgot/reset password)
  • 🌦 Climate zone lookup (future: weather forecast proxy)
  • πŸ—“ Event and plant management with categories
  • πŸ“· Unsplash proxy endpoint (safe keys, cache-friendly)
  • πŸ“§ Email delivery with Nodemailer (App Password or SMTP)
  • πŸ”’ Validators, CORS, and logger utility for cleaner DX

Stack

  • Frontend: React (Vite), Axios, TailwindCSS
  • Backend: Node.js 18+, Express, MongoDB (Mongoose), JWT, Nodemailer
  • Shared: npm package @daidensacha/almanac-shared

Quick Start

Server

cd almanac-server
npm install
cp .env.example .env
npm start

Requirements:

  • Node.js 18+
  • MongoDB (local or Atlas cluster)
  • Gmail App Password (or SMTP credentials)

Client

cd almanac-client
npm install
npm start

Environment Variables (Server)

# App
PORT=8000
NODE_ENV=development
CLIENT_URL=http://localhost:3000

# Database
DATABASE_URL=mongodb://127.0.0.1:27017/garden_almanac

# JWT
JWT_SECRET=super_secret_for_auth_tokens
JWT_ACCOUNT_ACTIVATION=activation_secret_for_signup

# Email
EMAIL_FROM=[email protected]
EMAIL_TO=[email protected]
GMAIL_PASSWORD=your_gmail_app_password

# Unsplash
UNSPLASH_ACCESS_KEY=your_unsplash_key

API Overview

Base URL: /api

Auth

  • POST /signup + POST /account-activation
  • POST /signin
  • PUT /forgot-password
  • PUT /reset-password

User

  • GET /user/:id
  • PUT /user/update

Domain

  • GET /categories
  • GET /plants
  • GET /events
  • CRUD variants for each

Utilities

  • GET /climate-zone/:lat/:lon
  • GET /unsplash/photos?query=…

Example: Password Reset Flow

# Request reset
domain/api/forgot-password { email }

# User clicks emailed link β†’ frontend route `/reset-password/:token`

# Confirm reset
domain/api/reset-password { token, newPassword }

Shared Package

almanac-shared provides reusable constants and validation rules.

Exports:

  • PASSWORD_REGEX
  • PASSWORD_MESSAGE

Usage:

// Client (ESM)
import { PASSWORD_REGEX, PASSWORD_MESSAGE } from '@daidensacha/almanac-shared';

// Server (CommonJS)
const { PASSWORD_REGEX } = require('@daidensacha/almanac-shared');

Development Workflow

See Branching & Deploy Playbook and CONTRIBUTING.

  • Protected branch: main
  • Branches: feature/<name> or fix/<name>
  • Use conventional commits
  • PRs should link issues and show testing steps

Roadmap

  • Weather API proxy (Open-Meteo) + caching
  • Recurrence rules (RRULE) for events
  • Agenda/cron reminders (email β†’ push)
  • Security hardening (Helmet, rate-limit, deeper validation)
  • Advanced dashboard features (charts, plant insights)

Contributing

See CONTRIBUTING.md

  • Comment or open an issue before starting
  • Use feature branches from main
  • Keep PRs focused & small
  • Add screenshots/gifs when relevant

Quick Links:


License

MIT Β© Daiden Sacha

About

πŸ‘‰ Backend API for the Garden Almanac MERN app β€” Node.js + Express with MongoDB for storing garden entries and user data.

Topics

Resources

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published