Skip to content

Repository files navigation

Memories API

ASP.NET Core 10 REST API for time-locked letters, encrypted journal memories, and AI-generated reflective questions. Supports JWT authentication, email verification, offline sync, and SQLite or PostgreSQL (Supabase).

Features

  • Authentication — Register, login, email verification (OTP), password reset
  • Letters — Create messages that unlock on a future date (AES-256 encrypted)
  • Memories — Journal entries with images and emoji tags
  • Questions — AI-generated reflection questions (Google Gemini), answered asynchronously via background worker
  • Offline sync — Idempotent create using client-generated IDs
  • Database — SQLite (local dev) or Supabase/PostgreSQL (production)

Tech Stack

Layer Technology
Framework ASP.NET Core 10
ORM Entity Framework Core
Auth JWT Bearer
Docs Scalar / OpenAPI
Logging Serilog
Mapping AutoMapper

Prerequisites

Quick Start

1. Clone and configure

git clone <your-repo-url>
cd WebApplication1
copy appsettings.Development.example.json appsettings.Development.json

Edit appsettings.Development.json with your secrets (this file is gitignored).

Minimum values to set:

Key Description
Jwt:Key At least 32 characters
Encryption:Key Exactly 32 characters (changing it invalidates existing encrypted data)
Gemini:ApiKey Required for AI questions
Smtp:* Required for email verification and password reset

For SQLite only (default), set "Database": { "Provider": "Sqlite" } in appsettings.json or Development config.

2. Run

dotnet restore
dotnet run
  • API: https://localhost:7261 (see Properties/launchSettings.json)
  • Scalar UI (Development): https://localhost:7261/scalar

Migrations run automatically on startup when using SQLite in Development.

3. Try it

# Register
curl -X POST https://localhost:7261/api/auth/register `
  -H "Content-Type: application/json" `
  -d '{"username":"demo","email":"you@example.com","password":"Password123!","confirmPassword":"Password123!"}'

Use the returned JWT in Authorization: Bearer <token> for protected endpoints.

Configuration

Setting Default Notes
Database:Provider Sqlite Sqlite or Supabase
ConnectionStrings:DefaultConnection Data\app.db SQLite path
ConnectionStrings:SupabaseConnection PostgreSQL connection string
Jwt:ExpirationMinutes 10080 7 days

See the documentation folder for API reference, architecture, and setup guides.

Project Structure

Controllers/       HTTP endpoints
Services/          Business logic (Interfaces + Implementations)
DTOs/              Request/response models
Domains/           EF entity models
Data/              DbContext and database files
Infrastructure/    Middleware, background workers, AutoMapper
Migrations/        EF Core migrations (SQLite)
docs/              Architecture, API, and module documentation
Properties/        Launch settings

Database

SQLite (development)

dotnet ef database update

Supabase

Set Database:Provider to Supabase and apply schema manually (see docs/guides/supabase.md). EF migrations are intended for SQLite.

Security Notes

  • Never commit appsettings.Development.json or real API keys.
  • Rotate JWT, encryption, SMTP, and database credentials if they were ever committed to git.
  • Letter and memory content is encrypted at rest with Encryption:Key.

License

MIT (or add your preferred license)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages