Skip to content

Shonei/echo

Repository files navigation

Echo

Echo is a Phoenix application featuring Chat, Request Echoing, and Audit Logging capabilities.

Local Development

To start your Phoenix server:

  1. Install dependencies:

    mix setup
  2. Environment Variables (Optional):

    • AUDIT_PASSWORD: Master password for Audit API (POST requests).
  3. Start the server:

    mix phx.server

Visit localhost:4000 in your browser.

API Endpoints

JSON API (/api/v1)

Resource Method Endpoint Description Auth
Audit POST /audit/sessions Create session Yes (Bearer)
POST /audit/events Log event Yes (Bearer)
GET /audit/sessions List sessions No
GET /audit/sessions/:id/events List events No
Chat GET /chat/rooms List rooms No
GET /chat/:room/messages Get messages No
POST /chat/:room/messages Post message No
Rooms GET /rooms List rooms No
POST /rooms Create room No
Blogs GET /blogs List blogs No
POST /blogs Create blog No
GET /blogs/:id Get blog No
PUT /blogs/:id Update metadata No
PUT /blogs/:id/content Update content No
DELETE /blogs/:id Delete blog No
Revisions GET /blogs/:id/revisions List revisions No
POST /blogs/:id/revisions Create revision No

Authentication: For protected endpoints, send the header Authorization: Bearer <AUDIT_PASSWORD>.

Documentation

Detailed API documentation can be found in the docs/ folder:

Web Interface

  • /chat - Real-time chat interface.
  • /echo/request - View echoed HTTP requests.

Production Config

To run in production, set these environment variables:

Variable Description Required
DATABASE_PATH Path to SQLite DB (e.g., /data/echo.db) Yes
SECRET_KEY_BASE Generate with mix phx.gen.secret Yes
PHX_HOST Domain name (e.g., myapp.com) Yes
AUDIT_PASSWORD Password for Audit API Yes

Running a Release

# 1. Build release
mix release

# 2. Start server
PHX_SERVER=true bin/echo start

For detailed deployment steps, see the Phoenix Deployment Guides.

About

Test HTTP server to echo requests

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors