This is the backend repository for Nacimiento - Memory Egg.
Nacimiento - Memory Egg is a gamified journaling web application where users take care of a mysterious egg by writing notebook posts, completing quests, and earning credits called Will.
The egg changes over time through the accumulation of memories, reflections, and daily writing. Users can spend Will on egg appearance, background themes, music, and other care-related items.
The egg does not hatch from time.
It hatches from what is remembered.
This project is not only about a game.
The egg represents something forgotten and fragile that the user chooses to care for. The application encourages users to spend small moments of their busy lives writing, reflecting, and recording memories. Through this habit, the egg gradually changes, symbolizing the user's own process of remembering and taking care of themselves.
- Frontend: memory-egg-front
- Backend: memory-egg-back
- Backend API Base URL:
https://memory-egg-back.onrender.com - Swagger / OpenAPI Documentation:
https://memory-egg-back.onrender.com/api-docs
This backend handles:
- User registration and login
- JWT-based authentication
- Protected API routes
- Egg state and equipped items
- Notebook post creation, retrieval, and deletion
- Will reward calculation
- Daily quest assignment and reward claiming
- Shop and inventory logic
- SQLite database persistence
- API validation and security checks
- Swagger / OpenAPI documentation
- Unit and API-level tests
- GitHub Actions continuous integration
| Area | Technology | Reason |
|---|---|---|
| Runtime | Node.js | JavaScript runtime for backend development |
| Server Framework | Express | Lightweight framework for REST API development |
| Database | SQLite | Chosen for lightweight implementation and simple project deployment |
| Authentication | JWT | Token-based authentication for protected routes |
| Password Security | bcrypt | Passwords are stored as hashes, not plaintext |
| API Documentation | Swagger UI + OpenAPI YAML | Documents API contract and request/response schemas |
| Testing | Jest + Supertest | Unit tests and API-level tests |
| CI | GitHub Actions | Automatically runs tests on push |
src/
controllers/
routes/
models/
services/
middleware/
validators/
tests/
app.js
server.js
docs/
api/
openapi.yaml
Create a .env file using .env.example
cp .env.example .envOn Windows PowerShell, use:
Copy-Item .env.example .envThen open .env and replace the placeholder values with your local configuration. To generate a strong JWT secret, you can run:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"Never commit the real .env file to GitHub.
git clone https://github.com/Driedoutjerky/memory-egg-back.git
cd memory-egg-backnpm installCreate a .env file using the environment variable format above.
npm startThe backend runs on:
http://localhost:5000
Health check:
GET http://localhost:5000/api/health
API documentation:
http://localhost:5000/api-docs
The OpenAPI specification file is located at:
docs/api/openapi.yaml
The Swagger UI documentation is served at /api-docs
Deployed documentation:
Hosted by Render : https://memory-egg-back.onrender.com/api-docs
| Method | Path | Purpose | Auth Required |
|---|---|---|---|
| GET | /api/health |
Check backend server status | No |
| POST | /api/auth/register |
Register new user and create starter egg | No |
| POST | /api/auth/login |
Login user | No |
| GET | /api/auth/me |
Get current user profile, egg, and equipped items | Yes |
| GET | /api/auth/me/inventory |
View owned items | Yes |
| PATCH | /api/egg/equip |
Equip background, music, or cosmetic item | Yes |
| PATCH | /api/egg/unequip |
Unequip background, music, or cosmetic item | Yes |
| POST | /api/posts |
Create notebook post | Yes |
| GET | /api/posts/all |
Get all posts created by current user | Yes |
| GET | /api/posts/:id |
Get one post | Yes |
| DELETE | /api/posts/:id |
Delete own post | Yes |
| GET | /api/quests/today |
Get today's assigned quests | Yes |
| POST | /api/quests/:id/claim |
Claim completed quest reward | Yes |
| GET | /api/shop/items |
Browse shop items | Yes |
| POST | /api/shop/purchase |
Buy item with Will | Yes |
Run all tests with:
npm testRun tests with coverage:
npm run test:coverageThe test suite includes:
- Unit tests for backend modules
- API tests for authenticated routes
- API tests for successful main flows
- API tests for error cases such as
400,401,404, and409
This repository uses GitHub Actions to run the test suite automatically on push.
The CI workflow helps verify that the backend remains stable after changes and that tests pass before evaluation.
AI tools were used to help generate example mock data for development and testing. AI tools were not used as a replacement for understanding the submitted implementation.
This project is under the Apache-2.0 license.