Skip to content

Repository files navigation

E.L.I.A.S. - Backend API ⚙️🤖

This repository contains the backend API for E.L.I.A.S. (Event & Logic Intelligent Assistant System). It connects with the frontend (Vue.js) app. It has secure endpoints, event logic and a real-time AI Helpdesk.

The code uses a Service Layer approach (for example HelpdeskService, EventService, AuthService) to keep business logic separate from the HTTP controllers and make the codebase easier to maintain. External integrations (like OpenAI) are separated into dedicated integration classes.

🚀 Technology Stack

  • Framework: Laravel 12 (PHP 8.4+)
  • Database: SQLite (local development)
  • Authentication: Laravel Sanctum (Bearer token)
  • AI Engine: OpenAI API (gpt-4o-mini, SSE stream)
  • Advanced AI features:
    • Server-sent Events (SSE) for real-time text streaming.
    • Context-aware prompt engineering (Retrieval-Augmented Generation basics)
    • Multilingual support with strict data integrity rules.
    • Human-agent handoff logic ([AGENT] trigger).

🛠️ Installation and run (local)

Follow these steps in your terminal to run the backend:

1. Clone the repository and install dependencies

git clone https://github.com/kokenydaniel/elias-backend.git
cd elias-backend
composer install

2. Set up environment variables (.env)

Make a copy of the example configuration file:

cp .env.example .env
php artisan key:generate

Open the new .env file and set the required variables:

Required

  • OPENAI_API_KEY=...

Recommended

  • FRONTEND_URL=http://localhost:5173 (used for password reset links)

Optional

  • OPENAI_MODEL=gpt-4o-mini
  • OPENAI_TEMPERATURE=0.2

3. Database migration and test data (Seeding)

The system uses an SQLite database. You do not need an SQL server. Run this to create tables and load test accounts:

php artisan migrate:fresh --seed

4. Start the server

php artisan serve

The API now listens at http://localhost:8000/api.


🔑 Demo Login details

After you seed the database, you can log in on the frontend (or in Postman) with these accounts:

The universal password for ALL accounts is: password123

User accounts (with calendar events):

  • Email: marcus@elias.com (Has ONLY English events - good for testing AI rules)
  • Email: diana@elias.com (Has ONLY Hungarian events)
  • Email: charlie@elias.com (Has MIXED English & Hungarian events)
  • Email: user@elias.com (Empty calendar for fresh testing)

Agent accounts (Helpdesk dashboard):

  • Email: agent@elias.com
  • Email: alex.agent@elias.com

📧 Testing Password Reset

This project runs locally. You do not need a real SMTP server to test password reset emails. The app uses Laravel's log mailer.

How to test it for evaluation?

  1. Click "Forgot password" on the frontend and type and existing email address.
  2. Open the storage/logs/laravel.log file in the backend folder.
  3. Scroll to the bottom of the file. You will see the generated email with HTML code. Find the link http://localhost:5173/reset-password?token=...
  4. Open this link in your browser to set a new password!

📚 API Documentation

You can find the documentation and ready-to-test requests (with payload examples) in the ELIAS_API_Collection.json Postman Collection file in the project root.

Optional (alternative format): docs/openapi.yaml

How to use:

  1. Open the Postman app.
  2. Click the Import button.
  3. Upload the ELIAS_API_Collection.json file.
  4. Log in at the /login endpoint. Copy the token.
  5. Go to the Collection's Variables tab and paste the token into the token variable.
  6. Now you can test the protected endpoints.

Notes

  • MFA: If the user has MFA enabled, /login returns a temporary token that can only be used for POST /verify/mfa.
  • Helpdesk streaming: POST /helpdesk/messages can return:
    • JSON (if the conversation is not handled by the bot), or
    • text/event-stream (SSE) when the bot is handling the conversation and streams its reply.

About

Backend REST API for the E.L.I.A.S. (Event & Logic Intelligent Assistant System) project. Built with Laravel and SQLite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages