This project is a hybrid monolith application featuring microservices for authentication (auth-service
) and API proxying (api-proxy-service
) to the Rick and Morty API. It is built using Express and React with TypeScript. A shared folder is included for shared types across the services.
- Prerequisites
- Installation
- Environment Variables
- Running the Application
- Generating Documentation
- Project Structure
- Technologies Used
- Usage
- Login Credentials
Ensure you have the following software installed:
- Node.js (version 18.18.0 or above)
- npm (version 6.x or above)
- TypeScript (
npm install -g typescript
)
-
Clone the repository:
git clone https://github.com/pini85/morty-hybrid-monorepo.git cd morty-hybrid-monorepo
-
Install dependencies for all services using npm workspaces:
npm install
Create .env
files in the root directories of auth-service
and api-proxy-service
with the following variables:
JWT_SECRET=veryComplexSecret
PORT=5000
JWT_SECRET=veryComplexSecret
PORT=5001
Ensure that JWT_SECRET
is the same in both services.
To start the application, run the following command from the root directory:
npm run start
This command will start the auth-service
, api-proxy-service
, and client
microservices. The client will be available at http://localhost:5173
.
To generate documentation using TypeDoc, run the following command:
npm run docs
Ensure you have TypeScript installed globally to use the tsc
command:
npm install -g typescript
morty-hybrid-monorepo/
├── README.md
├── auth-service/
│ ├── nodemon.json
│ ├── package.json
│ ├── src/
│ └── tsconfig.json
├── api-proxy-service/
│ ├── nodemon.json
│ ├── package.json
│ ├── src/
│ └── tsconfig.json
├── client/
│ ├── README.md
│ ├── index.html
│ ├── node_modules/
│ ├── package.json
│ ├── public/
│ ├── src/
│ ├── tsconfig.json
│ ├── tsconfig.node.json
│ └── vite.config.ts
├── shared/
│ ├── package-lock.json
│ ├── package.json
│ ├── src/
│ └── tsconfig.json
├── docs/
│ ├── index.html
│ ├── ...
├── node_modules/
├── package-lock.json
├── package.json
├── tsconfig.json
├── typedoc.json
- Backend: Node.js, Express, TypeScript
- Frontend: React, TypeScript, styled-components, react-query
- Authentication: JWT (JSON Web Tokens)
- Documentation: TypeDoc
-
Install dependencies using npm:
npm install
-
Create
.env
files in theauth-service
andapi-proxy-service
directories. -
Run the application:
npm run start
-
Access the client at
http://localhost:5173
. -
Generate documentation:
npm run docs
Admin Credentials:
- Username: admin
- Password: admin123
User Credentials:
- Username: user
- Password: user123
For further details, please refer to the source code and comments.