Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A website with a simple design, with an example of how to make a login website with Astro.
Astro Login is a boilerplate template that provides a working username-and-password login flow built with the Astro framework, including a styled dark-theme login page, an error page, and an authenticated profile page. It is maintained by Zastinian, who also runs Hedystia, and is demonstrated live at astro-login.hedystia.com.
Astro Login is an open-source Astro project that gives developers a complete login system to copy into their own sites. It takes login credentials from src/utils/routes.ts, reads user profile data from src/utils/profile.ts, and outputs a session cookie that protects the rest of the site. The template runs on Astro's development server, uses environment variables to control cookie behavior, and is distributed through the Zastinian GitHub repository.
src/utils/routes.ts and src/utils/profile.ts, so you can edit one file instead of a database..env.example and set COOKIE_SECRET, COOKIE_SECURE, MAX_AGE, PORT (default 4321), and HOST (default localhost) to fit your deployment.When a user submits the login form, the Astro API route checks the credentials against the data in routes.ts. On success it sets a signed cookie with the configured secret, valid for MAX_AGE seconds; on failure it renders the error page. The profile page then reads the cookie and displays the user's data from profile.ts.
Yes, it is published as an open-source GitHub repository under the Zastinian account, and the README explicitly invites contributions and reports, with no mention of any license fee.
The README's "How to edit" table lists three files: src/utils/routes.ts for login database or user details, src/utils/profile.ts for profile data, and .env.example for environment variables.
The default PORT is 4321 and the default HOST is localhost. These can be changed through environment variables without touching code.
No. The default configuration stores login details inside routes.ts, so you can run a functional login flow with only the source files. If you need a real database, you can replace the contents of routes.ts with your own logic.
