A backend for the ultimate platform for discovering and promoting local services and businesses.
Whether you're a service provider looking to reach more customers or someone in need of a specific service, ServiceAd connects you with the best options in your area.
✅ Service Discovery: Search and filter local services by category, name, or location.
✅ Service Promotion: Service providers can register and promote their services with detailed descriptions and images.
✅ Authentication: Secure JWT-based signup, login, and token revalidation for user protection.
✅ GraphQL API: Flexible, efficient data querying for frontend clients.
✅ MongoDB Integration: Stores users, services, images, and categories with Mongoose schemas.
✅ Image Handling: Supports service profile images via Base64 uploads.
✅ Fully Deployed: Live backend on Render, frontend on Vercel, with Netlify deployment support included.
- Backend: Node.js, Apollo Server (GraphQL), MongoDB, Mongoose
- Auth: JWT, bcrypt
- Frontend: (can be any frontend or mobile app with GraphQL client)
- Deployment: Render (backend), Vercel & Netlify (frontend support)
- Other Tools: dotenv, CORS, base64 image handling
``` root/ │ ├── api/ │ ├── index.js # Entry for Vercel deployment │ └── server.js │ ├── graphql/ │ ├── index.js │ ├── typeDefs.js │ └── resolvers.js │ ├── models/ │ ├── Category.js │ ├── Umage.js │ ├── Post.js │ ├── Service.js │ ├── Post.js │ ├── Review.js │ ├── ServiceType.js │ └── User.js │ ├── lib │ └── actions.js │ └── db-connection.js │ ├── netlify/functions/ │ └── server.js # Entry for Netlify deployment │ ├── index.js # Main entry point for local/dev ├── .env.example ├── .gitignore ├── netlify.toml ├── vercel.json └── package.json ```
```bash git clone https://github.com/Andu-alem/serviceadgraphql.git cd servicead ```
```bash npm install ```
Create a `.env` file based on `.env.example`:
``` MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key PORT=4000 ```
```bash node index.js ```
The server will start at: ``` http://localhost:4000/ ```
Access the GraphQL Playground at: ``` http://localhost:4000/graphql ```
-
Vercel: Uses `api/index.js` and `api/server.js` for deployment.
-
Render: Deploy `index.js` as your server entry point with your environment variables set in the Render dashboard.
-
Netlify: Uses `netlify/functions/server.js` for Netlify Functions deployment.
```graphql mutation { signup(username: "john", email: "john@example.com", password: "password123") } ```
```graphql mutation { login(email: "john@example.com", password: "password123") } ```
```graphql mutation { registerService( serviceName: "Plumbing Service", serviceType: "Home Maintenance", category: "Plumbing", city: "Addis Ababa", uniqueaddress: "Bole Road", description: "Professional plumbing services for all your needs.", profileImage: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD..." ) { id serviceName description address { city uniqueaddress } category { name } } } ```
Andualem Fereja Bayisa
This project is licensed under the MIT License.
Pull requests are welcome. If you wish to contribute:
- Fork the repo
- Create your feature branch (`git checkout -b feature/new-feature`)
- Commit your changes (`git commit -m 'Add new feature'`)
- Push to the branch (`git push origin feature/new-feature`)
- Open a pull request
Built to showcase GraphQL backend engineering, authentication, and deployment skills with a practical, live service promotion and discovery platform.