From-scratch implementation of authentication flow over HTTPS using stateful back-end session management.
nuxt3
, aws-ses
, postgresql
Live deployment httpsauth.munozarturo.com.
- Authentication FLow
- Security Headers
- API Rate Limiter
- Fix SVGs
- QOL
- Improve form formatting.
- SEO and Meta
- Documentation
- Improve
README.md
. - Write guide on how to implement authentication from scracth.
- Improve
-
Set environmet variables in
.env
.NODE_ENV="development|production" PGSQL_URI="" # postgres connection string NUXT_URL="" # deployment URL, eg. https://httpsauth.munozarturo.com DOMAIN="" # domain (used for emails), eg. httpsauth.munozarturo.com or communications.munozarturo.com AWS_REGION="" # AWS region, eg. us-east-2 AWS_KEY="" # AWS key AWS_SECRET_ACCESS_KEY="" # AWS secret access key
-
Run
npm run db:generate
. -
Run the SQL scripts in
utils/db/out
in the database engine.- This project is built to work with PostgreSQL.
-
Run
npm run dev
for local development.
Remove the following:
getStats
inutils/db/auth-actions.ts
server/api/auth/stats.get.ts
- stats display in
pages/index.vue
There is an event publish/subscribe plugin implemented in plugins/events.ts
. It is possible to listen to events using the following pattern
const { $subcribe } = useNuxtApp();
$subcribe("auth:sign-out", () => {
console.log("Signed Out.")
});
and emit events using this pattern
const { $publish } = useNuxtApp();
$publish("auth:sign-out", null); // can change event payload type from null to something else
from here.
The build command is different since there are some issues with the vue-email
package and including the esbuild-linux-64
directory in the output. Refer to this GitHub issue.
"scripts": {
...,
"build": "nuxt build && cp -r ./node_modules/esbuild-linux-64 ./.vercel/output/functions/__nitro.func/node_modules/esbuild-linux-64",
...,
},
If the deployment service is something other than Vercel, ./.vercel/output/functions/__nitro.func/node_modules/esbuild-linux-64
can be replaced with the output directory is for the deployment service.