A simple defect/bug ticket tracker with a Node.js + Express backend and MySQL database.
defect-tracker/
├── server.js # Express API server
├── schema.sql # Database setup
├── package.json
├── .env.example # Copy to .env and fill in your values
├── .gitignore
└── public/
└── index.html # Frontend UI
npm install# Run the schema against your MySQL instance
mysql -u root -p < schema.sqlcp .env.example .env
# Edit .env with your database credentialsnpm start
# or for development with auto-reload:
npm run devOpen http://localhost:3001 in your browser.
git init
git add .
git commit -m "initial commit"
git remote add origin https://github.com/YOUR_USERNAME/defect-tracker
git push -u origin main- Go to railway.com → New Project → Deploy from GitHub repo
- Select your repository → Deploy Now
- In your Railway project canvas, click New → Database → MySQL
- Railway provisions the database and exposes these variables automatically:
MYSQLHOST,MYSQLPORT,MYSQLUSER,MYSQLPASSWORD,MYSQLDATABASE
In your Node service → Variables tab, add:
DB_HOST=${{MySQL.MYSQLHOST}}
DB_PORT=${{MySQL.MYSQLPORT}}
DB_USER=${{MySQL.MYSQLUSER}}
DB_PASSWORD=${{MySQL.MYSQLPASSWORD}}
DB_NAME=${{MySQL.MYSQLDATABASE}}
In your MySQL service on Railway, open the Query tab and paste the contents of schema.sql.
Railway will auto-deploy on every push to main from this point on.
| Method | Path | Description |
|---|---|---|
| GET | /api/tickets |
List all tickets. Query params: status, priority, q |
| POST | /api/tickets |
Create a new ticket |
| PATCH | /api/tickets/:id |
Update a ticket |
| DELETE | /api/tickets/:id |
Delete a ticket |