diff --git a/.env.example b/.env.example index eb0ff1f..34b9de5 100755 --- a/.env.example +++ b/.env.example @@ -8,6 +8,8 @@ API_KEY= SENDER_NAME= API_KEYS= FRONTEND_URL= -SUPER_ADMIN_EMAIL= -JWT_SECRET= -ADMIN_EMAIL= +PUSHER_APP_ID= +PUSHER_KEY= +PUSHER_SECRET= +PUSHER_CLUSTER= +Gnews_Api_Key= diff --git a/README.md b/README.md index db6a982..0e7366d 100755 --- a/README.md +++ b/README.md @@ -1,114 +1,40 @@ - -# DevPulse Backend +# atlp-devpulse-bn ## Introduction -DevPulse is an innovative platform designed to handle ratings for companies in the **Ed-tech** industry, with its first paying customer being **Andela**. It is currently under development using modern web technologies that prioritize speed and security. This repository contains the codebase for the backend part of the platform, which utilizes **GraphQL, Apollo, and MongoDB**. - -## Table of Contents - -- [Hosted Link](#hosted-link) -- [Features](#features) -- [Technologies](#technologies) -- [Getting Started](#getting-started) - - [Prerequisites](#prerequisites) - - [Installation](#installation) -- [Usage](#usage) -- [API Documentation](#api-documentation) -- [Contributing](#contributing) -- [Contact](#contact) +Pulse is a platform designed to handle ratings for the companies in the **Ed-tech** industries with the its first paying customer being **Andela**. It is currently under development using modern web technologies that prioritize speed and security. This repo holds the codebase for the backend part of the platform which uses **Graphql, Apollo and mongoDB**. ## Hosted Link -The backend is currently hosted at: [https://atlp-devpulse-bn.onrender.com/](https://atlp-devpulse-bn.onrender.com/) - -## Features - -- Real-time performance metrics tracking -- Advanced attendance management -- Dynamic application cycle overview -- Secure authentication and authorization -- Scalable GraphQL API - -## Technologies - -To successfully navigate and contribute to the codebase, you should have an understanding of the following technologies: - -- [GraphQL](https://graphql.org/): A query language for APIs -- [TypeScript](https://www.typescriptlang.org/): A typed superset of JavaScript -- [Apollo Server](https://www.apollographql.com/docs/apollo-server/): A GraphQL server -- [MongoDB](https://www.mongodb.com/): A NoSQL database -- [Node.js](https://nodejs.org/): A JavaScript runtime -- [Express](https://expressjs.com/): A web application framework for Node.js - -## Getting Started - -### Prerequisites - -Before running this project, make sure you have the following installed: +https://andela-devpulse-backend.devpulse.co/ -- [Node.js](https://nodejs.org/) (version 14 or later) -- [Git](https://git-scm.com/) -- [MongoDB](https://www.mongodb.com/try/download/community) (local installation or a cloud-hosted instance) +## How to run -### Installation +To run this project on your local machine make sure that all the following are checked -1. Clone the repository: - ```bash - git clone https://github.com/atlp-rwanda/atlp-devpulse-bn.git - ``` +- [ ] Nodejs installed on your computer ([MacOS](https://nodejs.org/en/download/), [Windows](https://nodejs.org/en/download/), [Linux](https://nodejs.org/en/download/)) +- [ ] Git installed on your computer -2. Navigate to the project directory: - ```bash - cd atlp-devpulse-bn - ``` +Use the following commands to get started with the project -3. Install dependencies: - ```bash - npm install - ``` +```js +git clone https://github.com/atlp-rwanda/atlp-devpulse-bn.git +cd atlp-devpulse-bn +npm install +npm run dev -4. Set up environment variables: - - Copy the `.env.example` file to `.env` - - Fill in the required environment variables -5. Start the development server: - ```bash - npm run dev - ``` +### Other scripts and their usages +- `npm run build` is used to build the production ready version of the projects. +Used during deployment -## Usage - -### Available Scripts - -- `npm run dev`: Starts the development server using nodemon -- `npm start`: Starts the production server -- `npm test`: Runs the test suite using Jest -- `npm run build`: Builds the production-ready version of the project using TypeScript compiler -- `npm run seed`: Runs the database seeding script - -## API Documentation - -For detailed information about the API endpoints and how to use them, please refer to our [API Documentation](https://atlp-devpulse-bn.onrender.com/graphql). - -## Contributing - -We welcome contributions to the DevPulse project! Please follow these steps to contribute: - -1. Fork the repository -2. Create a new branch (`git checkout -b feature/AmazingFeature`) -3. Make your changes -4. Commit your changes (`git commit -m 'Add some AmazingFeature'`) -5. Push to the branch (`git push origin feature/AmazingFeature`) -6. Open a Pull Request - -Please make sure to update tests as appropriate and adhere to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct. - - -## Contact +## Technologies -DevPulse Team - [devpulsedev@gmail.com](mailto:devpulsedev@gmail.com) +To successfully navigate the codebase of the project, you will need undertanding +of the following technologies that are being used to develop this application: -Project Links: -- [https://github.com/atlp-rwanda/atlp-devpulse-bn](https://github.com/atlp-rwanda/atlp-devpulse-bn) -- https://atlp-devpulse-bn.onrender.com/ +- GraphQl +- Typescript +- Apollo server +- MongoDB +``` diff --git a/package.json b/package.json index 1eab401..8fd48b0 100755 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "@graphql-tools/merge": "^8.3.7", "@sendgrid/mail": "^8.1.3", "apollo-server": "^3.10.2", - "apollo-server-express": "^3.13.0", "axios": "^1.7.7", "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", diff --git a/public/assets/apple-touch-icon.png b/public/assets/apple-touch-icon.png deleted file mode 100644 index 296c6d4..0000000 Binary files a/public/assets/apple-touch-icon.png and /dev/null differ diff --git a/public/assets/devpulse.svg b/public/assets/devpulse.svg deleted file mode 100644 index de42cf9..0000000 --- a/public/assets/devpulse.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/public/assets/favicon-96x96.png b/public/assets/favicon-96x96.png deleted file mode 100644 index f94d865..0000000 Binary files a/public/assets/favicon-96x96.png and /dev/null differ diff --git a/public/assets/favicon.ico b/public/assets/favicon.ico deleted file mode 100644 index a2bd7ea..0000000 Binary files a/public/assets/favicon.ico and /dev/null differ diff --git a/public/assets/favicon.svg b/public/assets/favicon.svg deleted file mode 100644 index 9da25ce..0000000 --- a/public/assets/favicon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/public/assets/site.webmanifest b/public/assets/site.webmanifest deleted file mode 100644 index ccf313a..0000000 --- a/public/assets/site.webmanifest +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "MyWebSite", - "short_name": "MySite", - "icons": [ - { - "src": "/web-app-manifest-192x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/web-app-manifest-512x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} \ No newline at end of file diff --git a/public/assets/web-app-manifest-192x192.png b/public/assets/web-app-manifest-192x192.png deleted file mode 100644 index 389e03d..0000000 Binary files a/public/assets/web-app-manifest-192x192.png and /dev/null differ diff --git a/public/assets/web-app-manifest-512x512.png b/public/assets/web-app-manifest-512x512.png deleted file mode 100644 index 1eaee21..0000000 Binary files a/public/assets/web-app-manifest-512x512.png and /dev/null differ diff --git a/public/css/doc.css b/public/css/doc.css deleted file mode 100644 index 41ceca3..0000000 --- a/public/css/doc.css +++ /dev/null @@ -1,190 +0,0 @@ -:root { - --color-primary: #16a34a; - --color-primary-dark: #15803d; - --color-primary-light: #dcfce7; - --color-background: #f0fdf4; - --color-text: #333333; - --color-text-light: #666666; - --color-code-bg: #f3f4f6; -} - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Inter', sans-serif; - line-height: 1.6; - color: var(--color-text); - background: var(--color-background); -} - -.container { - max-width: 1250px; - margin: 0 auto; - padding: 0 20px; -} - - -header { - background-color: var(--color-primary); - color: white; - padding: 1rem 0; - position: sticky; - top: 0; - -} - -nav { - display: flex; - justify-content: space-between; - align-items: center; -} - -.logo { - font-size: 1.5rem; - font-weight: bold; - display: flex ; - align-items: center; - justify-items: center; - -} - -.logo img { - width: 40px; - height: 40px; - margin: auto 0; - color: white; - margin-right: 0.5rem; - -} - -.logo p{ - margin: auto 0; -} - -.nav-links { - display: flex; - gap: 1rem; -} - -.nav-links a { - color: white; - text-decoration: none; - font-size: 0.9rem; -} - -main { - padding: 2rem 0; -} - -.topheader{ - display: flex; - justify-content: space-between; - -} - -h1, h2, h3 { - color: var(--color-primary-dark); - margin-bottom: 1rem; -} - -h1 { - font-size: 2.5rem; - border-bottom: 2px solid #b2f8cb; - ; - padding-bottom: 0.5rem; -} - -h2 { - font-size: 1.8rem; - margin-top: 2rem; -} - -h3 { - font-size: 1.3rem; - margin-top: 1.5rem; -} - -p { - margin-bottom: 1rem; -} - -ul, ol { - margin-bottom: 1rem; - padding-left: 2rem; -} - -code { - font-family: 'Courier New', Courier, monospace; - background-color: var(--color-code-bg); - padding: 0.2rem 0.4rem; - border-radius: 0.25rem; -} - -pre { - background-color: var(--color-code-bg); - padding: 1rem; - border-radius: 0.5rem; - overflow-x: auto; - margin-bottom: 1rem; -} - -pre code { - background-color: transparent; - padding: 0; -} - -.cta-button { - display: inline-block; - background-color: var(--color-primary); - color: white; - text-decoration: none; - padding: 0.75rem 1.5rem; - border-radius: 0.25rem; - font-weight: 500; - border: none; - font-size: 1rem; - transition: background-color 0.3s ease; -} - -.cta-button:hover { - background-color: var(--color-primary-dark); -} - -footer { - background-color: var(--color-primary-light); - color: var(--color-text); - padding: 2rem 0; - margin-top: 4rem; -} - -.footer-content { - display: flex; - justify-content: space-between; - align-items: center; -} - -.footer-links a { - color: var(--color-primary); - text-decoration: none; - margin-left: 1rem; -} - -@media (max-width: 768px) { - .nav-links { - display: none; - } - - h1 { - font-size: 2rem; - } - - .footer-content { - flex-direction: column; - gap: 1rem; - } -} - diff --git a/public/css/style.css b/public/css/style.css deleted file mode 100644 index c5602f9..0000000 --- a/public/css/style.css +++ /dev/null @@ -1,213 +0,0 @@ -:root { - --color-primary: #16a34a; - --color-primary-dark: #15803d; - --color-primary-light: #dcfce7; - --color-background: #f0fdf4; - --color-text: #333333; - --color-text-light: #666666; -} - -* { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - font-family: 'Inter', sans-serif; - line-height: 1.6; - color: var(--color-text); - background: linear-gradient(to bottom, var(--color-background), #ffffff); - min-height: 100vh; -} - -.container { - max-width: 1300px; - margin: 0 auto; - padding: 0 20px; -} - -header { - background-color: var(--color-primary); - color: white; - padding: 1rem 0; -} - -nav { - display: flex; - justify-content: space-between; - align-items: center; -} - -.logo { - font-size: 1.5rem; - font-weight: bold; - display: flex !important; - align-items: center; - text-align: center; - gap: 0.5rem; - justify-items: center; -} - -.logo img { - width: 50px; - height: 50px; - color: white; - margin-left: 2rem; -} - - -.nav-links { - display: flex; - gap: 1rem; -} - -.nav-links a { - color: white; - text-decoration: none; - font-size: 0.9rem; -} - -main { - padding: 4rem 0; -} - -.hero { - text-align: center; - margin-bottom: 4rem; -} - -h1 { - font-size: 2.5rem; - color: var(--color-primary-dark); - margin-bottom: 1rem; -} - -.hero p { - font-size: 1.1rem; - color: var(--color-text-light); - max-width: 800px; - margin: 0 auto 2rem; -} - -.cta-button { - display: inline-block; - background-color: var(--color-primary); - color: white; - text-decoration: none; - padding: 0.75rem 1.5rem; - border-radius: 0.25rem; - font-weight: 500; - transition: background-color 0.3s ease; -} - -.cta-button:hover { - background-color: var(--color-primary-dark); -} - -.features { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); - gap: 2rem; - margin-top: 4rem; -} - -.feature-card { - background-color: white; - border: 1px solid var(--color-primary-light); - border-radius: 0.5rem; - padding: 1.5rem; - transition: box-shadow 0.3s ease, transform 0.3s ease; -} - -.feature-card:hover { - box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); - transform: translateY(-5px); -} - -.feature-icon { - font-size: 2rem; - color: var(--color-primary); - margin-bottom: 1rem; -} - -h2 { - font-size: 1.25rem; - color: var(--color-primary-dark); - margin-bottom: 0.5rem; -} - -.get-started { - text-align: center; - margin-top: 4rem; -} - -.get-started h2 { - font-size: 2rem; - margin-bottom: 1rem; -} - -.button-group { - display: flex; - justify-content: center; - gap: 1rem; - margin-top: 1.5rem; -} - -.secondary-button { - display: inline-block; - background-color: white; - color: var(--color-primary); - text-decoration: none; - padding: 0.75rem 1.5rem; - border-radius: 0.25rem; - font-weight: 500; - border: 1px solid var(--color-primary); - transition: background-color 0.3s ease, color 0.3s ease; -} - -.secondary-button:hover { - background-color: var(--color-primary-light); -} - -footer { - background-color: var(--color-primary-light); - color: var(--color-text); - padding: 2rem 0; - margin-top: 4rem; -} - -.footer-content { - display: flex; - justify-content: space-between; - align-items: center; -} - -.footer-links a { - color: var(--color-primary); - text-decoration: none; - margin-left: 1rem; -} - -@media (max-width: 768px) { - .nav-links { - display: none; - } - - h1 { - font-size: 2rem; - } - - .hero p { - font-size: 1rem; - } - - .features { - grid-template-columns: 1fr; - } - - .footer-content { - flex-direction: column; - gap: 1rem; - } -} diff --git a/public/documentation.html b/public/documentation.html deleted file mode 100644 index eb638ce..0000000 --- a/public/documentation.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - DevPulse Documentation - Ed-tech Management Platform - - - - - - - - - - -
-
- -
-
- -
-
-
-

DevPulse Documentation

- -
- - -
-

Introduction

-

DevPulse is a platform designed to handle ratings for companies in the Ed-tech industries, with its - first paying customer being Andela. It is currently under development using modern web technologies - that prioritize speed and security. This documentation covers the backend part of the platform, - which uses Express, GraphQL, Apollo, and MongoDB.

-
- -
-

Hosted Link

-

The backend is hosted at: https://atlp-devpulse-bn.onrender.com/

-
- -
-

How to Run

-

To run this project on your local machine, ensure you have the following prerequisites:

-
    -
  • Node.js installed on your computer (MacOS, Windows, Linux)
  • -
  • Git installed on your computer
  • -
-

Use the following commands to get started with the project:

-
git clone https://github.com/atlp-rwanda/atlp-devpulse-bn.git
-cd atlp-devpulse-bn
-npm install
-npm run dev
-
- -
-

Other Scripts and Their Usages

-
    -
  • npm run build - Used to build the production-ready version of the project. This is - used during deployment.
  • -
-
- -
-

Technologies

-

To successfully navigate the codebase of the project, you will need an understanding of the following - technologies:

-
    -
  • GraphQL
  • -
  • TypeScript
  • -
  • Apollo server
  • -
  • MongoDB
  • -
-
- -
-

Frontend

-

The frontend of DevPulse is hosted at: https://atlp-devpulse-fn.vercel.app/

-

The frontend GitHub repository can be found at: https://github.com/atlp-rwanda/atlp-devpulse-fn

-
- -
-

Environment Variables

-

The following environment variables are required for the project:

-
NODE_ENV=<environment>
-MONGO_DEV_DB=<development-database-uri>
-MONGO_TEST_DB=<testing-database-uri>
-MONGO_PROD_DB=<production-database-uri>
-PORT=<server-port>
-DEVPULSE_EMAIL=<email-used-for-sending-emails-verified-with-sendgrid>
-API_KEY=<api-key-provided-from-sendgrid>
-SENDER_NAME=<Sender name of sendgrid>
-API_KEYS=<api-key-provided-from-google-sheet-api>
-FRONTEND_URL=<Frontend-url-at-which-the-frontend-app-is-running-on>
-SUPER_ADMIN_EMAIL=<super-admin-email>
-JWT_SECRET=<jwt-secret>
-ADMIN_EMAIL=<admin-email>
-
- - - -
-

Support

-

If you encounter any issues or have questions about DevPulse, please open an issue on the GitHub Issues - page.

-
- - -
-
- - - - - diff --git a/public/index.html b/public/index.html deleted file mode 100644 index b7b7e64..0000000 --- a/public/index.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - DevPulse - Innovative Ed-tech Management Platform - - - - - - - - - - -
-
- -
-
- -
-
-
-

Welcome to DevPulse

-

An innovative platform for managing team performance, tracking attendance, and analyzing application - cycles in the Ed-tech industry.

- Explore GraphQL API -
- -
-
-
📊
-

Real-Time Performance Metrics

-

Gain valuable insights into individual and team progress through real-time tracking and automated - feedback systems.

-
-
-
📅
-

Advanced Attendance Management

-

Ensure consistent and efficient tracking of attendance across different cohorts and programs with - integrated data handling.

-
-
-
👥
-

Dynamic Application Cycle Overview

-

Stay informed with detailed cycle statuses and trends, simplifying the recruitment and evaluation - process.

-
-
- -
-

Get Started with DevPulse

-

Explore our comprehensive documentation to integrate DevPulse into your workflow.

- -
-
-
- - - - - diff --git a/src/index.ts b/src/index.ts old mode 100644 new mode 100755 index d32a177..cc50b3d --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { ApolloServer } from 'apollo-server-express'; +import { ApolloServer } from "apollo-server"; import { mergeResolvers, mergeTypeDefs } from "@graphql-tools/merge"; import { connect } from "./database/db.config"; import "./utils/cronJob"; @@ -88,8 +88,6 @@ import { jobApplicationTypeDefs } from "./schema/jobApplicationSchema"; import { jobApplicationResolver } from "./resolvers/jobApplicationResolver"; import { blogRelatedResolvers } from "./resolvers/blogRelatedArticlesResolver"; import { blogRelatedArticlesSchema } from "./schema/blogRelatedArticlesSchema"; -import express from 'express'; -import path from 'path'; const PORT = process.env.PORT || 3000; @@ -182,10 +180,6 @@ const typeDefs = mergeTypeDefs([ blogRelatedArticlesSchema ]); -connect(); -const app = express(); -app.use(express.static(path.join(__dirname, '../public'))); - const server = new ApolloServer({ typeDefs, resolvers, @@ -212,13 +206,7 @@ const server = new ApolloServer({ plugins: [ApolloServerPluginInlineTrace()], }); -(async () => { - await server.start(); - server.applyMiddleware({ app }); - - app.listen(PORT, () => { - console.log(`Server ready at http://localhost:${PORT}${server.graphqlPath}`); - console.log(`Landing page available at http://localhost:${PORT}/`); - }); -})(); - +connect().then(() => { + console.log("Database connected!"); + server.listen(PORT).then(({ url }) => console.info(`App on ${url}`)); +}); diff --git a/tsconfig.json b/tsconfig.json index 4676cdd..615c0bb 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */