Skip to content

Underwaterr/Punk-Cafe-API

Repository files navigation

Punk Cafe

Sick of Instagram so I made my own.

  • 🤫 Invite-only
  • 🤗 Everyone follows everyone else
  • 🥳 Chronological feed
  • 😎 98.6% code coverage from Node's built-in test runner

The Stack

This repo is just the back-end: TypeScript and Prisma with PostgreSQL. Express for routing, Pino for logging and Vine for validation.

Prisma is the ORM, handling database schemas and relations, including data integrity, indexing and cascading deletes.

Image processing is handled via Sharp. Image uploads are validated and compressed server-side, using magic-bytes to determine file type.

This runs on a VPS with Caddy for the reverse proxy. Kept alive with a systemd service. Docker containerizes the database.

I have a self-hosted instance of Uptime Kuma to monitor uptime, integrated with ntfy so I get a phone notification if something goes wrong.

The front-end is an iOS app written in Swift.

Architecture

To keep related concerns together, I went for an entity-based folder structure. Each entity gets their own model, controller, router, schema and test file.

Authentication is handled with token-based sessions issued on login and checked with each request. No cookies since this is iOS-only. Registration requires invitation codes generated by existing members.

About

Sick of Instagram so I made my own

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors