I am writing Tourscout team's Identity management dev proposal. Make it friendly and…
- User
I am writing Tourscout team's Identity management dev proposal. Make it friendly and funny, interactive and interesting.
TourScout's identity management system will focus on two primary aspects: Authentication (who are you?) and Authorization (what can you do?). Supabase, our chosen platform, supports a wide variety of authentication methods, including email, Google, Apple, and Facebook sign-ins. To efficiently manage both authentication and authorization, we propose a serverless architecture using JWT (JSON Web Tokens).
![[AEC99E.png]]
Architecture Options
Serverful: Separate Node.js Server
- Single API server processes all requests
- Easier integration with legacy systems
- Less vendor lock-in
- More expensive and harder to scale due to Amdahl's Law
- Requires separate backend hosting provider (e.g., AWS Elastic Beanstalk or Railway)
Serverless (Recommended)
- Splits "server" into smaller, on-demand pieces (Middlewares or FaaS)
- Some workarounds may be required
- Can be entirely hosted within Supabase
- More in line with industry trends, although slightly unstable and experimental
Authentication
JWT (Recommended)
We recommend using JWT for authentication, as it provides a more scalable and secure solution compared to session-based authentication. JWT issues a cryptographic "proof" to the user, acting as a national ID that can be reused across multiple servers.
Sessions
- Server maintains static "memory" of user identity
- Scalability issues (i.e. how can we "share" the in-memory session data with peer servers? Redis solves this problem, but that's Netflix level engineering)
Conclusion
I'd still recommend JWT approach with Serverless Architecture within Supabase Edge. It should be straightforward to implement, but some CTO noted, **Almost no one got JWT tokens and webhooks right on the first try.**, so there will be bumps and hills for upcoming weeks. It is not a small project, since on the front-end we will need a Context Management Toolings for React, which is harder; some popular tools include Recoil (more recent) and Redux (more classic, established)
- Assistant