This project is a leetcode problem storage web app built using TypeScript, Node.js, React.js, GraphQL, and MongoDB. It allows users to store and organize their leetcode problems they have solved. This is meant as a training project for MongoDB, GraphQL and Typescript.
- Getting Started
- Project Structure
- Configuration
- Running the Application
- Technologies Used
- Contributing
- License
Before you begin, ensure you have the following installed on your machine:
- Node.js (version 18.X.X)
- npm (version 5.X.X)
- MongoDB (running locally or a connection to a MongoDB instance)
-
Clone the repository:
git clone https://github.com/your-username/Leetcode-Storage-App.git
-
Navigate to the project directory:
-
Install dependencies for both the server and client:
cd server npm install cd ../client npm install
The project is organized into two main parts:
- server: Node.js server with GraphQL API and MongoDB database.
- client: React.js client for the front end.
event-booking-index/
|-- server/
| |-- graphql/
| |-- models/
| |-- middleware/
| |-- index.ts
| |-- .env
| |-- package.json
| |-- tsconfig.json
|-- client/
| |-- public/
| |-- src/
| | |-- components/
| | |-- containers/
| | |-- pages/
| | |-- App.tsx
| | |-- index.tsx
| |-- package.json
| |-- tsconfig.json
|-- .gitignore
|-- README.md
-
Update the necessary configuration values in the .env file inside the folder package, such as MongoDB connection details.
-
Running the Application
Start the server:
cd server
npx ts-node index.ts
The server will be running at http://localhost:4000.
Start the client
cd client
npm start
The client will be accessible at http://localhost:3000.
The GraphQL API is accessible at:
- Endpoint: http://localhost:4000/graphql
Use this endpoint to interact with the Leetcode Storage App GraphQL API. You can make queries and mutations to manage your leetcode problems.
To create a new problem, you can use the following example mutation:
mutation {
createProblem(problemInput: {
title: "Two Sum"
level: "Easy"
description: "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order."
frequency: 5
link: "https://leetcode.com/problems/two-sum/"
data_structure: "Array"
date: "2023-12-31T00:00:00.000Z"
}) {
_id
title
level
description
frequency
link
data_structure
date
}
}
query {
problems {
_id
title
level
description
frequency
link
data_structure
date
}
}
Node.js, Ts-node, TypeScript, React.js, GraphQL, MongoDB
Feel free to contribute by opening issues or pull requests.
This project is licensed under the MIT License.