MINIX-PHP
A lightweight social network written in plain PHP — no framework — on a cloud PostgreSQL database, with posts, likes, comments, and a feed built from your friends.
OVERVIEW
MiniX-PHP is a small social network I built without a framework, to understand what frameworks normally hide: sessions, password hashing, routing by page, and talking to PostgreSQL directly.
Users register, sign in, publish posts, like and comment, search for other people, and build a friends list. The home page shows their own posts next to a feed of their friends’ posts, each with a live like count.
ARCHITECTURE
Each page is its own controller: it checks the session, handles any form it received with a POST → redirect → GET pattern (so a refresh never re-submits), then queries and renders.
pgsql extension over SSL.DATA MODEL
Five tables. Friendship is stored in both directions, one row per side, which keeps the “my friends” and “friends’ posts” queries simple.
comments(post_id, user_id, comment)
FEATURES
- Accounts: usernames limited to letters, numbers, and underscores; passwords of at least 8 characters with letters and digits, stored with
password_hashand checked withpassword_verify. - Posts, likes, comments: each user can like a post once — the server checks before inserting.
- Friends: add or remove in one action, with a guard against duplicates; case-insensitive user search that excludes yourself.
- Feeds: your posts and your friends’ posts, newest first, each with its like count.
SECURITY CHOICES
pg_query_params, so user input is never concatenated into SQL.htmlspecialchars before it is rendered.DEPLOYMENT
Deployed on Railway with a Nixpacks build that installs PHP 8.2 and the PostgreSQL extension, then serves the app with PHP’s built-in server. The database lives on Supabase.
git clone https://github.com/AAFLY99/MiniX-PHP.git cd MiniX-PHP php -S localhost:3000