Welcome to the Scribe Project! 🚀
This guide will help you get the backend (PHP) and frontend (React/Vite) up and running in no time. Let's make your dev experience smooth and fun! 😎
/ (root)
├── api/ # PHP backend
│ ├── ...
│ └── .env # Backend environment variables
├── src/ # React frontend
│ ├── components/
│ ├── pages/
│ └── ...
├── .env # Frontend environment variables
└── README.md # This file!
git clone <your-repo-url>
cd <your-project-folder>- Install Composer dependencies:
cd api composer install cd ..
- Create your backend
.envfile:# api/.env DB_HOST=localhost DB_NAME=your_db DB_USER=your_user DB_PASS=your_pass MAIL_HOST=smtp.gmail.com MAIL_USERNAME=your_email@gmail.com MAIL_PASSWORD=your_mail_password MAIL_PORT=587 MAIL_ENCRYPTION=tls MAIL_FROM=your_email@gmail.com MAIL_FROM_NAME="Scribe Blog" APP_URL=http://localhost/api UPLOADS_DIR=uploads
- Run your PHP server:
cd api php -S localhost:8000 # Or use XAMPP/Laragon/etc. and point to the api/ folder
- Install Node dependencies:
npm install # or yarn install - Create your frontend
.envfile:# .env (in project root) VITE_API_BASE_URL=http://localhost/api
- Run the React app:
npm run dev # or yarn dev
- Visit http://localhost:5173 (or the port Vite shows) to see your frontend.
- Backend API should be running at http://localhost:8000 or your chosen port.
- Try signing up, logging in, posting, and more! 📝
- .env files are 🔑! Double-check your API URLs and credentials.
- Use the service layer: All frontend API calls go through
src/services/api.service.ts. - Need to add a new API?
- Add the PHP file in the correct
api/subfolder. - Add a function in
api.service.ts. - Import and use it in your React code.
- Add the PHP file in the correct
- Having CORS issues? Make sure your
APP_URLandVITE_API_BASE_URLmatch and your PHP headers allow the frontend origin.
- This project uses modern React, Vite, and PHP best practices.
- The UI is powered by beautiful components in
src/components/ui/. - Want to contribute? Fork, branch, and PR! We love new ideas. 💡
- Found a bug? 🐛 Open an issue and let's squash it together!
- Check the comments in the code for extra tips.
- Ask your teammates or open a discussion.
- Or just add more emojis to your commit messages! 🎉
Happy coding! ✨