Build your own password authentication
Build a password authentication system with Postgres, bcrypt and the blowfish algorithm. No auth provider and no external service.
We start with a reactive login form, add a database migration for the users table, then hash and check passwords by hand in Postgres to see how it works. Then we wire it together end to end: the form, the rpc behind it, and the session.
We finish by having Claude Code build the whole thing from scratch: a fully functioning authentication system with beautiful sign in and create account pages, and the tests to prove it works.
0:00 Introduction0:04 Create project0:16 Create the login html page0:27 Reactive conditional rendering0:41 The session.login() method0:57 The session.logout() method1:01 Event handler stubs1:18 The HTML constructor attribute1:33 Wiring up the event handlers1:52 Builtin security build errors2:22 The @rpc build tag2:41 Binding form inputs2:59 Reactive HTML state3:14 Create the users migration3:21 Edit the migration file3:45 Insert a user with hashed password4:11 The elements db command4:24 The authentication sql query5:20 Wire the rpc functions5:54 No sql injection risk6:26 Catch auth errors in the browser6:50 Reactive HTML wired up7:03 Prompt Claude Code to build authentication7:33 The elements test command
Comments· 0