You can look at the code generated by phx.gen.auth, lots of lessons to learn there. The generator is getting a big revamp on the upcoming Phoenix v1.8 release, focusing on magic-link authentication (worth looking at the newer code).
You could use the same or similar token-issuing and session management code. When a new user shows up you generate a session token, optionally an automatic guest user.
Having a guest user might makes things easier if you need to save state associated with a user_id. If you can / intend to save all temporary data on the session (cookie), then you could probably do without a user entity until they decide to create an account and then you can import the data from the session into the DB.






















