A web application for tracking emotional triggers and their impacts.
- Create and manage emotional trigger entries
- Track trigger events, factual descriptions, associated emotions, meanings, and past relationships
- RESTful API built with Elysia.js
- PostgreSQL database for data persistence
- Responsive frontend (refer to frontend repository)
- Bun runtime environment
- PostgreSQL database
- Node.js and npm/yarn (for frontend dependencies)
-
Clone the repository:
git clone https://github.com/yourusername/trigger-tracking-app.git cd trigger-tracking-app
-
Install dependencies:
bun install
-
Set up environment variables: Create a
.env
file in the project root with the following:DATABASE_URL=postgresql://username:password@localhost:5432/trigger_map
Replace
username
,password
with your PostgreSQL credentials. -
Run database migrations:
bun run migrate
bun run dev
The API will be available at http://localhost:3000.
bun run start
GET /triggers
- Get all triggersGET /triggers/:id
- Get a specific triggerPOST /triggers
- Create a new triggerDELETE /triggers/:id
- Delete a trigger
curl -X POST http://localhost:3000/triggers \
-H "Content-Type: application/json" \
-d '{
"triggerEvent": "Example event",
"factualDescription": "Detailed description",
"emotions": ["anxiety", "frustration"],
"meaning": "What this means to me",
"pastRelationship": "How this relates to my past",
"triggerName": "Brief name"
}'
The application uses a PostgreSQL database with the following schema:
CREATE TABLE IF NOT EXISTS triggers (
id SERIAL PRIMARY KEY,
trigger_event TEXT NOT NULL,
factual_description TEXT NOT NULL,
emotions JSONB NOT NULL,
meaning TEXT NOT NULL,
past_relationship TEXT,
trigger_name TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
bun test
This application is designed to be deployed on Vercel with a PostgreSQL database.
- Set up a PostgreSQL database (Vercel Postgres, Supabase, etc.)
- Connect your GitHub repository to Vercel
- Set the environment variables in the Vercel dashboard
- Deploy!
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Project Link: https://github.com/natecalc/trigger-tracking-app