This is the backend service for the TrickBook application, a platform for skateboarders to track their trick progress, share listings, and connect with other skaters.
The backend is built with Node.js and Express, using MongoDB as the database. It serves as the API layer for both the React Native mobile app and the Next.js web application.
- Authentication: JWT-based auth with support for both email/password and Google SSO
- Image Processing: Handles image uploads and resizing for listings and user profiles
- Real-time Features: Push notifications for messages and updates
- MongoDB Collections:
- Users
- Listings (User Trick Lists)
- Tricks (User-specific)
- Trickipedia (Global tricks encyclopedia)
- Messages
- Blog Posts
- Categories
POST /api/auth
- Regular email/password loginPOST /api/auth/google-auth
- Google SSO authentication
GET /api/user/me
- Get current user profileGET /api/users
- Get users (admin only)PUT /api/user
- Update user profileDELETE /api/users/:id
- Delete user (requires account owner or admin)
GET /api/listings
- Get all trick lists for a user (each list is a collection of tricks)POST /api/listings
- Create new trick listGET /api/listings/countTrickLists
- Get count of trick listsGET /api/listings/all
- Get all trick lists
GET /api/listing
- Get all tricks in a specific trick list (by list_id)PUT /api/listing/:id
- Update a trick in a trick listPUT /api/listing/edit
- Edit a trick in a trick listPUT /api/listing/update
- Update trick completion statusPOST /api/listing
- Add a new trick to a trick listDELETE /api/listing/:id
- Delete a trick from a trick listGET /api/listing/allData
- Get all tricks (admin/debug)GET /api/listing/allTricks
- Get all tricks for a user (flattened)GET /api/listing/graph
- Get trick completion graph data
GET /api/trickipedia
- Get all tricks (with optional filtering:?category=...&difficulty=...&search=...
)GET /api/trickipedia/category/:category
- Get tricks by category (with optional filtering)GET /api/trickipedia/:id
- Get a single trick by IDPOST /api/trickipedia
- Create a new trick (admin only)PUT /api/trickipedia/:id
- Update a trick (admin only)DELETE /api/trickipedia/:id
- Delete a trick (admin only)
Note:
- Trickipedia is a global, admin-curated encyclopedia of tricks (not user-specific).
- Listings/Trick Lists (
/api/listings
) are user-specific collections of tricks for tracking personal progress.- Listing (
/api/listing
) is for CRUD operations on individual tricks within a user's trick list.
GET /api/messages
POST /api/trickImage/upload
- Upload a trick image to S3 (requirestrickUrl
query param, returns S3 URL)DELETE /api/trickImage/delete-folder/:slug
- Delete all images for a trick (by URL slug)
Example Upload:
- POST
/api/trickImage/upload?trickUrl=backside-pop-shove-it
- Form-data body:
file
(the image file) - Response:
{ "imageUrl": "https://trickbook.s3.amazonaws.com/backside-pop-shove-it/1687040000000-image.jpg" }
Example Delete:
- DELETE
/api/trickImage/delete-folder/backside-pop-shove-it