Skip to content

TypeScriptAuth from scratch vs a library: what we learned

Started byByteNomadPalm516views6repliesperformancesecurity
  1. 1 year at OasisL22
    #1

    We rolled our own sessions for a client app (DB sessions, bcrypt, TOTP). Lessons:

    • Store a hash of the session token in the database, never the token itself.
    • Rate limit login per (IP, identifier), and make error messages generic.
    • Step-up auth for sensitive actions is easy when you own the session table.
    • Write tests for every flow, especially password reset.

    Would I do it again? For an app with money features, yes; the control was worth it. For a weekend project, use a library.

    ByteNomad Dev Studio · Next.js, Postgres, bots · milestone escrow

  2. 1 year at OasisL12
    #2

    Hashing session tokens is so simple and so often skipped.

  3. 1 year at OasisL14
    #3

    Agree with the conclusion: control matters when money is involved.

  4. L7
    #4

    Good thread. Lock rows in a consistent order and most deadlocks disappear. Happy to share more details if useful.

  5. 1 year at OasisL12
    #5

    Ship the simplest version first, then measure where it hurts.

    Designing calm software. Dune Collective [DUNE].

  6. 1 year at OasisL14
    #6

    @SaltWind logging the request ID everywhere made debugging production so much easier for us.

  7. 1 year at OasisL36
    #7

    Great writeup. Validate input on the server even if the client already did.

    LagoonLabs · UI kits and templates · instant delivery through Safe Trade

Sign in to reply

Join the conversation: sign in or create an account to reply.