/astro-ssr

A simple PWA build with Astro SSR and Strapi CMS.

Primary LanguageJavaScriptMIT LicenseMIT

Astro SSR Test App

A simple PWA app build with Astro SSR and Strapi CMS.

πŸ˜€ User Can:

  • View the optimal layout for the site depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Sign in / Sign out / Sign up
  • Add / Edit / Delete product
  • Add items to the cart
  • View the cart and remove items from it
  • See some cached images offline

❗️ Importan:

Deployed app can be seen here. It's server side is on HEROKU ('free tier' ), because of that

  • Server goes to sleep
  • If you are trying to load /product page, it might fail the first time (server is waking up), just reload
  • Authenticated users can upload images and see them, but after server goes to sleep, it erases them

πŸš€ Project Structure

Inside of the project, you'll see the following folders and files:

/
 backend/
 β””β”€β”€β”œβ”€β”€ (strapi)
 frontend/
 β””β”€β”€β”œβ”€β”€ public/
    β”‚   └── assets
    β”‚   └── icons
    β”‚   └── app.js
    β”‚   └── manifest.jso
    β”‚   └── service-worker.js
    β”‚   └── ... 
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   └── auth
    β”‚   β”‚       └── ...
    β”‚   β”‚   └── header
    β”‚   β”‚   └── product
    β”‚   β”‚   └── ...
    β”‚   β”œβ”€β”€ layouts/
    β”‚   β”‚   └── Layout.astro
    β”‚   └── pages/
    β”‚   β”‚   └── index.astro
    β”‚   β”‚   └── ...
    β”‚   └── interfaces/
    β”‚       └──ICartItem.ts
    β”‚       └── ...
    └── package.json

🧞 Instructions

First you need to create πŸ‘‡ (if it doesn't exist) in /frontend folder:

.env

Replace values with yours, without / in the end (❗️❗️❗️)

PUBLIC_SERVER_URL="http://localhost:1337"
PUBLIC_CLIENT_URL="http://localhost:3000"

To run the server:

open terminal
npm install (first time only)
cd backend
npm run development

go to http://localhost:1337/admin --> sign in (try to memorize your email/password ❗️)

To run the client:

open new terminal
npm install (first time only)
cd frontend
npm run dev

Make sure that urls match ones in .env, if not replace them.

πŸŽ‰

πŸ’» Preview: