- Node.js (v18 or later)
- npm (v9 or later)
- MongoDB (v6 or later)
- Git
-
Clone the repository:
git clone https://github.com/tarone-saloni/Greenstagram.git cd Greenstagram -
Install dependencies:
npm run install:all
-
Environment Setup:
- Copy
.env.exampleto.envin bothfrontendandbackenddirectories - Update the environment variables with your configuration
- Copy
-
Start Development Servers:
# Start frontend development server npm run dev:frontend # In another terminal, start the backend functions npm run dev:functions
Or run both together:
npm run dev
Greenstagram/
├── frontend/ # React frontend application
├── backend/ # Backend API services
└── netlify/ # Netlify serverless functions
npm run install:all- Install all dependenciesnpm run build- Build the projectnpm run dev- Start development environmentnpm run dev:frontend- Start frontend development servernpm run dev:functions- Start Netlify Functions development servernpm run deploy- Deploy to productionnpm run deploy:preview- Create a preview deployment
npm run dev- Start Vite dev servernpm run build- Build for productionnpm run lint- Run ESLintnpm run preview- Preview production build locally
- Strict mode enabled
- All files must have proper type definitions
- No
anytypes unless absolutely necessary - Use interface over type when possible
- No unused variables
- No unnecessary dependencies
- Consistent type definitions
- React hooks rules strictly enforced
- Single quotes
- No semicolons
- 2 space indentation
- 80 character line length
The project uses Husky for pre-commit hooks:
- Lint staged files
- Run type checking
- Run tests (if applicable)
- Format code
Required environment variables:
VITE_API_URL=http://localhost:8888/.netlify/functions
VITE_APP_ENV=development
MONGODB_URI=mongodb://localhost:27017/greenstagram
JWT_SECRET=your-secret-key
NODE_ENV=development
-
"Module not found" errors
- Solution: Run
npm run install:allagain - Check if all dependencies are properly installed
- Solution: Run
-
TypeScript errors
- Solution: Check if all required types are installed
- Run
npm install -D @types/[package-name]for missing types
-
Environment Variables not loading
- Solution: Check if .env files exist and are properly formatted
- Ensure variables are prefixed with VITE_ for frontend
-
Build failures
- Solution: Check build logs for specific errors
- Ensure all required dependencies are installed
- Verify TypeScript configuration
-
MongoDB Connection Issues
- Solution: Check if MongoDB is running
- Verify connection string in .env file
- Check network connectivity
If you encounter any issues not covered here:
- Check the existing GitHub issues
- Search the project documentation
- Create a new issue with:
- Detailed description of the problem
- Steps to reproduce
- Environment information
- Relevant error messages