Skip to content

chriscarias/notes-api-php

Repository files navigation

Secure Polyglot Notes API (PHP Layer)

A lightweight, high-performance, and secure native RESTful Notes API built using Modern PHP (Native PDO) and backed by a PostgreSQL database running inside a Docker container.

This project implements strict user isolation via JWT Authentication using a Front Controller routing architecture.

Features

  • Zero Heavy Frameworks: Built using pure, modern native PHP.
  • Front Controller Architecture: All requests are funneled through a single routing engine (index.php).
  • JWT Authentication: User validation and secure stateless token signatures via firebase/php-jwt.
  • Data Isolation: Database parameters strictly query user IDs to prevent cross-account leaks.

Tech Stack

  • Language: PHP 8.2+
  • Database Driver: PDO (PostgreSQL Extension)
  • Database: PostgreSQL 16 (Dockerized)
  • Package Manager: Composer

Local Setup & Installation

1. Clone the Repository

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

2. Install Dependencies

Pull down the required secure cryptographic JWT libraries using Composer:

composer install

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=super_secret_key

4. Launch the Local Server

php -S 127.0.0.1:8001

The API will be live and listening for network requests at http://127.0.0.1:8001/index.php.

About

Polyglot Notes API in PHP

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages