Shubhankar45 53dbfa976b -
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00
-
2026-11-13 12:14:55 +00:00

Saura Shakti — Solar Company Website

Development project (not deployed). React + Vite + Tailwind frontend, FastAPI + PostgreSQL backend, admin dashboard, and automatic logo watermarking of uploaded photos.

Part Status
Public website (from Figma) ✅ All 8 Figma sections, responsive; plus projects gallery, legal pages
Admin dashboard ✅ Login, dashboard, enquiries, projects + photos, services, testimonials, messages, subscribers, website text, admin users
Photo upload + watermark ✅ Official logo from Figma, applied automatically
Backend API + database ✅ 34 automated tests passing

Start / stop (everything)

scripts/dev.sh start     # PostgreSQL (Docker) + API + website
scripts/dev.sh stop      # stop all (database data is kept)
scripts/dev.sh status
scripts/dev.sh logs      # follow API + website logs
scripts/dev.sh test      # backend test suite (separate saurashakti_test database)
scripts/dev.sh migrate   # apply database migrations
What URL
Website http://localhost:5173
Admin dashboard http://localhost:5173/admin
API docs (Swagger) http://localhost:8020/docs
PostgreSQL 127.0.0.1:5440 (container saurashakti-website-dev-db)

Ports 8000/5432 were already used by other applications on this server, so 8020/5440 are used. The website dev server proxies /api and /media to the API, so the browser only talks to port 5173.

First-time setup

cp .env.example .env                       # DB credentials for docker-compose
cp backend/.env.example backend/.env       # same DB password + a random JWT secret
cd backend && python3 -m venv .venv && .venv/bin/pip install -r requirements.txt && cd ..
cd frontend && npm install && cd ..
scripts/dev.sh start

# create your admin account (password is prompted, never typed on the command line)
cd backend && .venv/bin/python -m app.cli create-admin --email you@example.com --name "Your Name"
#   roles: super_admin (default) | admin | editor      --update resets an existing account

To run Python commands yourself, use the project environment: source backend/.venv/bin/activate (or call backend/.venv/bin/python), not the conda base Python.

Design (Figma)

The design was read via the Figma API: design/DESIGN_ANALYSIS.md lists sections, colours, fonts and the decisions taken where the design had gaps. Original exports are in design/ (renders, full-size images, icons). The site uses web-optimised WebP versions (frontend/src/assets).

All copy on the page is admin-editable (Website content). Empty fields fall back to the Figma text, and the layout never changes. Until real services/testimonials are added, the sections show the design content.

Watermark

The official logo (exported from Figma, transparent PNG, trimmed) is at backend/assets/watermark/logo.png. Every admin image upload (projects, services, testimonials) is processed:

  • Original saved untouched in uploads/originals/ (not public; admins can download it).
  • Watermarked copy in uploads/watermarked/: logo bottom-right, 18% of image width (never upscaled beyond the logo's own resolution), 75% opacity, plus an automatic soft halo so it reads on bright and dark photos.
  • WEBP thumbnail ≤640px in uploads/thumbnails/.
  • Validation: JPG/JPEG/PNG/WEBP only, real content check, extension must match content, ≤10 MB, no animated/oversized images, random UUID filenames, multi-file uploads are all-or-nothing.

A larger logo file (e.g. 1500px wide or SVG) would give a sharper watermark on very large photos.

Quote calculator

Rates match the per-kW figures in the Figma design (₹37,000/kW equipment, ₹9,000/kW installation, 100 sq ft per kW). Subsidy follows PM Surya Ghar rules for residential (₹30k/kW up to 2 kW, ₹18k for the 3rd kW, max ₹78k), none for commercial. All rates are editable in Website content → Quote calculator rates.

  • Download Quotation → PDF generated by the backend.
  • Email Quotation → saves a lead in Enquiries (source "Quote calculator") and emails the PDF. Without SMTP settings, emails are saved as .eml files in backend/outbox/ (open them with any mail app). To send real email, set SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, MAIL_FROM in backend/.env.

API overview

Full docs at http://localhost:8020/docs.

Public: GET /api/health · POST /api/enquiries · POST /api/contact · POST /api/subscribe · GET /api/projects, /api/projects/{id|slug} · GET /api/services, /api/services/{id|slug} · GET /api/testimonials · GET /api/content, /api/content/{key} · GET /api/quotations/settings · POST /api/quotations/calculate | pdf | email

Auth: POST /api/auth/login · GET /api/auth/me · POST /api/auth/change-password

Admin (Bearer token): dashboard stats · enquiries (list/search/filter/detail/status/notes/delete) · projects CRUD · project images (multi-upload, caption, featured, delete, original download) · services CRUD + image · testimonials CRUD + image + video link · contact messages · subscribers · site content blocks · admin users (super admin only).

Roles

super_admin admin editor
Projects, photos, services, testimonials, website text ✅ ✅ ✅
View/update enquiries & messages ✅ ✅ ✅
Delete enquiries, messages, subscribers; reset text ✅ ✅ ❌
Manage admin accounts ✅ ❌ ❌

Security notes

Argon2id password hashing · JWT with expiry (expired sessions return to login) · per-request account checks · rate limits on login and public forms · honeypot spam field · strict upload validation · originals never public · secrets only in git-ignored .env files · dev servers bind to 127.0.0.1.

Project structure

backend/   FastAPI app (app/core, models, schemas, routes, services, middleware, utils), alembic/, tests/, uploads/
frontend/  React app: src/sections (Figma sections), pages, components, admin/ (dashboard), services/api.js
design/    Figma analysis, renders, original images, icons
docker-compose.yml   development PostgreSQL only
scripts/dev.sh       start/stop helper
S
Description
No description provided
Readme 3.1 MiB
Languages
JavaScript 52.9%
Python 45.3%
Shell 0.8%
CSS 0.6%
Mako 0.2%
Other 0.2%