Skip to content

seancampbell3161/chirpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chirpy

A small Twitter-like HTTP API written in Go. Users can sign up, log in, post chirps, and read them. Built as a learning project for backend fundamentals: routing, JWT auth, refresh tokens, and webhooks.

Stack

  • Go with chi for routing
  • JSON file (database.json) for storage
  • JWT access tokens + refresh tokens
  • Polka webhook integration for paid-user upgrades

Run

go run .

Server listens on :8080. Use -debug to wipe the database on startup.

Required env vars (in .env):

  • JWT_SECRET
  • POLKA_API_KEY

Endpoints

  • GET /api/healthz
  • GET /api/chirps — supports ?author_id= and ?sort=
  • GET /api/chirps/{id}
  • POST /api/chirps
  • DELETE /api/chirps/{id}
  • POST /api/users, PUT /api/users
  • POST /api/login, /api/refresh, /api/revoke
  • POST /api/polka/webhooks
  • GET /admin/metrics

About

A small Twitter-like HTTP API written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors