Express + PostgreSQL backend for tracking daily Binance trading activities and calculating airdrop eligibility points. Includes RESTful API for record management, monthly statistics, and health checks. Frontend served from public/ directory.
A Node.js/Express/PostgreSQL system for tracking daily trading activities and calculating points for Binance airdrop eligibility. The backend exposes RESTful APIs for record management and statistics, while the frontend is served from the `public/` directory.
The backend exposes the following RESTful endpoints:
1. Frontend makes API requests to backend endpoints
2. Backend processes requests and interacts with PostgreSQL database
3. Database operations are handled through `models/database.js`
4. Responses follow standard format: `{ success, data, message }`
When working with this project:
**Starting the server:**
**Database setup:**
**Docker deployment:**
**Upsert by date:**
**API response format:**
**Points calculation:**
**Error handling:**
**Static assets:**
**To add a new API endpoint:**
1. Define the route in `server.js` following existing patterns
2. Implement database logic in `models/database.js`
3. Follow the standard response format: `{ success, data, message }`
4. Add appropriate error handling
5. Test with the existing frontend or create new UI components in `public/`
**To modify database schema:**
1. Update the table structure in `models/database.js` (initDatabase function)
2. If needed, update `init.sql` for manual setup
3. Ensure existing API endpoints handle new fields appropriately
**To add frontend functionality:**
1. Add HTML/CSS/JS files to `public/` directory
2. Use fetch API to interact with backend endpoints
3. Handle responses in standard `{ success, data, message }` format
**Viewing records:**
**Creating/updating records:**
**Getting statistics:**
```javascript
// In server.js
app.get('/api/summary/daily/:date', async (req, res) => {
try {
const { date } = req.params;
const summary = await getDailySummary(date);
res.json({ success: true, data: summary, message: 'Daily summary retrieved' });
} catch (error) {
res.status(500).json({ success: false, message: error.message });
}
});
// In models/database.js
async function getDailySummary(date) {
const result = await pool.query(
'SELECT * FROM transactions WHERE date = $1',
[date]
);
// Calculate net_points
const record = result.rows[0];
if (record) {
record.net_points = record.points_balance + record.points_trading - record.points_consumed;
}
return record;
}
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/binance-airdrop-points-tracker/raw