Mason Green
Back to projects

AvePassBackend Developer

N/AApp deprecated and not available.

Role

Backend developer on a student food-ordering startup. I owned consumer-user REST routes in Node.js / Express against a shared Mongoose User model—create, read, update, and delete keyed by Firebase UID—plus contracts, tests, and release with the team. (Restaurant accounts were managed separately.)

Problem

The mobile app needed predictable auth and profile APIs on MongoDB after Firebase signup. With frequent student turnover, the users backend also needed clear structure and shared rules so feature work (settings, promotions, search) could continue without breaking existing clients.

Skills and technologies used

  • Node.js
  • Express
  • MongoDB / Mongoose
  • Firebase Auth
  • Joi
  • REST APIs

Overview

1 / 4

Goal

  • Maintain/extend the consumer-user API as features landed
  • Core surface: create users, edit settings, promotions, search, account teardown
  • Auth-scoped reads/writes via firebaseId

Drop unDraw SVG in public/.../unDraw/

User API CRUD

Here are five example routes I wrote for the consumer-user API from routes/users.js against the shared User model (app users, not restaurant accounts). Each card describes the method and its path, what it does, the MongoDB operation, and the skills that were required to implement it.

  • CREATEPOST /api/users/newUser

    After Firebase signup, look up the user by firebaseId. If missing, build a new User (anonymous or named), optionally generate a unique username, then persist.

    MongoDB: findOne new Modelsave(). Idempotent first write into the User collection.

    • Mongoose findOne
    • new Model + save
    • Firebase UID as key
    • Duplicate-guard responses
  • READGET /api/users/

    Load the authenticated caller's document via firebaseId from req.user.uid, validate, return JSON (success + user).

    MongoDB: auth-scoped User.findOne + shared validateUser guard—“get my profile.”

    • Auth-scoped query
    • validateUser guard
    • JSON API shape
  • UPDATEPOST /api/users/editSettings

    Joi-validate an updates object (email, username, names, receipts, privacy). Load the user, enforce username uniqueness, apply fields, save.

    MongoDB: findOne (user) + findOne (username clash) → mutate fields → save().

    • Joi body validation
    • Uniqueness query
    • Field-level rules
    • save after mutate
  • DELETEDELETE /api/users/

    Find by firebaseId, delete the Firebase Auth user, then remove the MongoDB document—dual cleanup for account teardown.

    MongoDB: findOne → document remove(), coordinated with the auth-provider delete.

    • findOne + remove
    • External auth + DB delete
    • Async error reporting
  • READGET /api/users/search:query

    List active users with a field projection, filter named profiles, fuzzy-match name / username, then annotate friend and invite state from the caller's document.

    MongoDB: find + selectprojection, then enrich from another doc's arrays (friendships / invites).

    • find + select
    • Active-user filter
    • Result enrichment
    • Collection query (not only by id)