Architecture - Afulton11/writzsol GitHub Wiki
Writzsol is a Next.js Application hosted on the Vercel platform.
Our backend is a simple API handling queries and mutations on our data. Due to Next.js' nature of handling API requests, Vercel auto-magically hosts each of our API functions on the AWS Lambda platform. One lambda function is used to represent our graphql database.
Our frontend is a (mostly) static website generated by Next.js using React. If a webpage is considered static, it's served directly from Vercel's CDN. Otherwise, the page will be rendered on the server and sent to the user (SSR).
Our data is hosted in a heroku postgresql hobby-tier database.
Here, we'll explain what each entity represents along with some uses.
User The entity representing Writzsol's user. Here, we store basic user information. This information is gernally retrieved upon logging into writzsol for the first time. Additionally, this data is auto-populated by next-auth.js.
-
namethe user's full name as retrieved from a authentication provider. e.g. "Andrew Fulton" -
emailthe user's email, retrieved from a provider. -
emailVerifiedthe date & time the user's email was verified -
imagethe user's avatar, sometimes populated by a provider.
https://next-auth.js.org/schemas/models
VerificationRequest An entity used during an email verification request.
-
identifierthe email the verification request was sent to. -
tokenthe verification token sent to the email address provided. It's valid for 24 hours.
Account An entity that represents an account from an authentication provider.
-
userIdThe id of the user this account is linked with. A user may have multiple provider accounts. -
providerTypeThe type of provider the account is from. e.g. "Google" or "Apple" -
providerIdThe provider's account Id -
refreshTokenA token given by the provider to generate access tokens; allows multiple uses without signing in again. -
accessTokenA token used to access the provider's OAuth API. -
accessTokenExpiresDate & Time when the accessToken expires.
Session Represent's a user's session within the Writzsol application. Each user can have multiple sessions, but each session can only have one user.
-
expiresthe Date & Time when this session expires and the user is logged out.
Website An entity representing an individual user's website. A user may have multiple different websites, but a site only belongs to a single user.
-
defaultThemethe default theme a user is presented when first visiting the site. e.g. "light" or "dark"
Page An entity representing a page within a individual website. A Website may belong to multiple pages, but a page only belongs to a single site.
-
paththe expected url path for this page from the root of the url. e.g./user/writzsol -
blocksA json array of blocks that represent data displayed on the page. This will represent the entire page and is really just a json object. The object data is based loosely off of editor.js' blocks. More information on this can be found on the blocks page.{ "title": "Writzsol", "blocks": [ { "type": "header", "data": { "size": 1, "text": "Hello Writzsol!" } }, { "type": "Image", "data": { "url": "https://..../../", "caption": "A Turtle", "...Image Settings": "...More Settings" } } ], "version": "0.2.5" }