Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camagru

Overview

Camagru is a 42 web project built as a small framework-free PHP application.

Users can register, confirm their email address, log in, capture or upload an image, compose it with transparent PNG stickers on the server side, publish the result in a public gallery, then like and comment on images.

The final image composition is done server-side with PHP GD.

Requirements

  • Docker
  • Docker Compose plugin (docker compose)
  • Run commands from the repository root

Environment

Create a local .env file from the example:

cp .env.example .env

Main variables:

Variable Purpose
APP_PORT Host port used by Docker, default 8080
APP_BASE_URL Base URL used for links and social sharing
APP_MAIL_FROM Sender address for application emails
APP_MAIL_REPLY_TO Optional reply-to address
MAILPIT_HOST Optional Mailpit SMTP host when using the mail profile
CAMAGRU_DEV_ENDPOINTS Development-only endpoints; keep unset for evaluation

.env must not be committed.

Run the app

docker compose up -d --build

Open:

http://localhost:8080

Quick check:

curl -fsS -o /tmp/camagru_login.html -w "HTTP %{http_code}\n" http://localhost:8080/login

Expected result:

HTTP 200

Run with Mailpit

Mailpit is useful to inspect local emails for:

  • registration confirmation
  • password reset
  • comment notifications

Start with Mailpit:

export MAILPIT_HOST=mailpit
docker compose --profile mail up -d --build

Open:

App:     http://localhost:8080
Mailpit: http://localhost:8025

Disable Mailpit / return to app-only mode

If MAILPIT_HOST was exported:

unset MAILPIT_HOST
docker compose down --remove-orphans
docker compose up -d --build

If MAILPIT_HOST=mailpit was added to .env, remove or comment it before starting the app-only mode.

Stop

docker compose down --remove-orphans

Reset local generated data

Warning: this deletes the local SQLite database and generated images.

docker compose down --remove-orphans
find database -maxdepth 1 -name 'camagru.db*' -delete
find public/uploads -mindepth 1 ! -name '.gitkeep' -delete
find public/tmp -mindepth 1 ! -name '.gitkeep' -delete
touch public/uploads/.gitkeep public/tmp/.gitkeep

The database is recreated automatically from database/schema.sql on the next container start.

Useful evaluation checks

Suggested manual checks:

  1. Register a user and confirm the account by email.
  2. Log in.
  3. Open /editor.
  4. Verify anonymous users are redirected from /editor to /login.
  5. Select a sticker before capture/upload.
  6. Capture or upload a base image.
  7. Compose and save the final image.
  8. Verify the image appears in the public gallery.
  9. Log in as another user.
  10. Like and comment on an image.
  11. Verify comment notification email behavior with Mailpit.
  12. Verify users can delete only their own images and comments.
  13. Verify /test and /test-db return 404 unless CAMAGRU_DEV_ENDPOINTS=1.

Notes

  • The project uses PHP 8.2, SQLite/PDO, PHP GD, HTML/CSS and vanilla JavaScript.
  • Docker Compose is the intended local run method.
  • Generated data is persisted in local mounted folders:
    • database/
    • public/uploads/
    • public/tmp/
  • Social sharing links using localhost work only locally. External platforms cannot fetch localhost URLs.
  • Dev endpoints are disabled by default.

License

MIT. See LICENSE.

About

42 web project: framework-free PHP photo app with email-confirmed accounts, webcam/upload capture, server-side PNG sticker composition via GD, and a public gallery with likes and comments. SQLite + Docker.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages