cocoon is a private journaling application with a react frontend and a fastapi backend. this repository is prepared for public source control and keeps local user data, credentials, and private backend code out of git.
- frontend built with react, react router, vite, typescript, and tailwind css
- backend built with fastapi and sqlite
- google oauth handled by the python backend
- progressive web app support for notifications and reminders
- public-safe backend entrypoint that can fall back to a local private implementation
the tracked backend entrypoint is backend/main.py.
- if
backend/main_private.pyexists locally,backend/main.pyloads it automatically - if
backend/main_private.pyis missing,backend/main.pyserves the redacted public backend frombackend/public_app.py
this lets the public repository stay open-source-friendly while keeping private routes and local application details outside version control.
- install dependencies:
npm install- create your local environment file from the example:
cp .env.example .env.local-
fill in the required oauth and application values in your local env file
-
if you need the full private backend locally, place it at
backend/main_private.py -
start the frontend:
npm run dev- start the backend in a second terminal:
python backend/main.pythe default frontend dev server runs on http://localhost:5173. the backend runs on http://localhost:8000.
the repository ships with .env.example for local setup. the main values are:
VITE_API_URLGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGOOGLE_REDIRECT_URIFRONTEND_URLSCOOKIE_SECURESECRET_KEYDATABASE_PATH
local env files are ignored by git. only .env.example is tracked.
npm run dev
npm run build
npm run preview
npm run lint
npm run typecheck
python backend/main.pythe following local-only files are intentionally ignored:
- env files other than
.env.example backend/main_private.py- sqlite database files and related local artifacts
- python cache files
- local backup exports such as
*-backup.jsonand*-encrypted-backup.json
if you plan to publish your fork, keep your database, local exports, and private backend implementation untracked.
- build the frontend with
npm run build - the generated frontend is served from
dist/when present - set
COOKIE_SECURE=truewhen deploying behind https - update
GOOGLE_REDIRECT_URIandFRONTEND_URLSfor your deployed domain - point
DATABASE_PATHat durable storage if you are not using the default local sqlite file
before pushing changes, the main checks are:
npm run typecheck
npm run lint
npm run build
python -m py_compile backend/main.py