ShopCo
ShopCo is where I moved from static pages to a real client–server app. The pages talk to a hosted REST API: accounts are created on the server, the signed-in user comes back in the response, and what you see depends on your role.
Technologies
- HTML
- CSS
- JavaScript
- REST API
- Authentication
- Role-based UI
- Postman
Create account
/auth/register
201{
"user": {
"firstName": "…",
"role": "customer"
},
"token": "eyJhbGciOi…"
}Front-end talks to a hosted REST API; the server decides the role
Problem
A storefront is only half a product. The other half is sending data to a server, handling whatever comes back, and showing different people different screens.
Solution
Registration and login post to a hosted API, the signed-in user is kept on the client, and the category, details, cart and admin pages render from API data with a role-aware interface.
Front-end and server, split properly
The browser asks; the server decides. That split is the whole lesson of this project.
Register or log in
The form posts to the hosted API
Server responds
User object and token come back
Session stored
Kept on the client for the next pages
Role-aware UI
Customers see the shop, admins see the admin page
What the client handles
- Form fields and validation
- Showing loading and error states
- Rendering products from API data
- Cart contents
What the server handles
- Creating accounts
- Checking credentials
- Assigning the role
- Storing products and orders
Endpoints were tested in Postman first; the collection is committed next to the code.
Key features
- Registration and login against a hosted API
- Role-aware interface for customers and admins
- Category and product detail pages
- Cart
- Admin page
- API requests collected in a Postman collection
What I learned
- Sending forms to an API and handling success and error responses
- The server decides roles; the interface only reflects them
- Testing endpoints in Postman before wiring up the UI