React.js + Vite + TypeScript + React Bootstrap = Re4cto
Re4cto is React based chat client with the combination of four popular development technologies; React, Vite, TypeScript, Bootstrap.
Re4cto features:
- Uses functional programming as recommended by the current React documentation.
- Uses custom fetch hook with error provider for fetch requests so fetch errors handled with simple bootstrap toast element.
- Authentication for fetch hooks is based on Bearer token stored in the browser's local storage but can be converted to cookie based.
- Uses Server Send Events(SSE) mechanism to retrieve messages so it can give live updates to users like WebSockets without backend server changes needed.
- Includes a Dockerfile to build for SaaS platforms.
Build demo is available on: https://src.1b4.dev/re4cto/ or on GitHub Pages
username:react (or) docker password:react (or) reacton12
- Node.js (v20+ recommended)
- npm/yarn
- Docker (optional for containerization)
-
Clone the repository
git clone https://github.com/1b4dev/Re4cto.git cd Re4cto
-
Install dependencies
npm install # or yarn install
-
Set up environment variables
You can simply edit .env file to connect your backend. If you don't have backend, you can use the currently connected backend for testing and development purposes. Please don't forget the edit fetch links on api request according to your backend.
# Edit .env file to point to your backend API VITE_API_URL=https://kern.1b4.dev/re4cto/api/
-
Run the app
npm run dev # or yarn dev
To connect your own backend:
- Update VITE_API_URL in .env
- Modify API endpoints
- Adjust authentication method in .env if you want to use cookie based auth
src/page/components/hooks/useApi.tsx # Switch between token/cookie auth basically supported in API calls. You also need to adjust Login.tsx and other token releated files if you want to use cookie method.
Please note that when you building Re4cto you need to adjust app base because of how Vite works. Currently app base set to yourdomainname.tld/re4cto/
# Create production build
npm run build
# Deploy
npm run deploy
# Docker build
docker build -t re4cto .
Contributions are welcome! Please follow these steps:
-
Fork the repository
-
Create your feature branch
git checkout -b feature/new
-
Commit your changes
git commit -m 'Commit new feature'
-
Push to the branch
git push origin feature/new
-
Open a Pull Request
Apache 2.0 Licence - See the LICENSE file for details