Oyan Store is a web application for an electronics e-commerce store, developed using NestJS on the backend and plain JavaScript on the frontend.
- Frontend: HTML, CSS, Vanilla JS
- Backend: NestJS, TypeScript, TypeORM, SQLite
- Authorization: JWT and
bcryptjs
- Navigate to the
backend-oyanfolder and install the dependencies:cd backend-oyan npm install - Create a
.envfile with the environment variables for SQLite:PORT=3000 DB_NAME=db.sqlite JWT_SECRET=very_secret_change_me JWT_EXPIRES_IN=3600s
- Start the server:
The server will run on
npm run start:dev
http://localhost:3000.
Open the frontend-oyan folder in your code editor and launch the index.html file using Live Server.
- How It Works: Live Server creates a local server (e.g., at
http://127.0.0.1:5500), which allows the frontend to communicate smoothly with the backend running on port3000.
- Authentication Logic: Upon a login attempt, if the user is not found, the application will automatically switch to registration mode.
- Token Storage: After a successful login, the access token is stored in the browser's
localStorageto maintain the session.