Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Polyglot Notes API (Go Layer)

A lightning-fast, statically typed, and secure native RESTful Notes API built using the Go Standard Library and backed by a PostgreSQL database running inside a Docker container.

This project implements strict user isolation via JWT Authentication using a custom native HTTP Context Middleware.

Features

  • Zero Heavy Web Frameworks: Built entirely using Go's native net/http and database/sql packages.
  • Strictly Typed Data: JSON payloads are decoded explicitly into Go structs to guarantee data integrity.
  • Context-Driven Security: JWT validation is handled by a custom middleware that safely passes verified User IDs through Go's thread-safe Context API.
  • Algorithm Confusion Defense: Strict HMAC algorithm verification during token parsing to prevent cryptographic downgrades.

Tech Stack

  • Language: Go 1.26+
  • Database Driver: github.com/lib/pq (Native PostgreSQL)
  • Authentication: github.com/golang-jwt/jwt/v5 & golang.org/x/crypto/bcrypt
  • Database: PostgreSQL 16 (Dockerized)

Local Setup & Installation

1. Clone the Repository

git clone https://github.com/chriscarias/notes-api-go.git
cd notes-api-go

2. Install Dependencies

Go tracks dependencies in go.mod. Pull them down into your local cache:

go mod download

3. Setup Environment Variables

Create a .env file in the root directory:

Code snippet
DB_HOST=127.0.0.1
DB_PORT=5433
DB_NAME=notes_db
DB_USER=user
DB_PASS=password
JWT_SECRET=secret_key

4. Launch the Native Binary Server

go run .

The compiler will spin up the native multithreaded server, listening at http://127.0.0.1:8002.

About

Polyglot Notes API with Go

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages