|
1 | | -# Sloopstash CTM App |
2 | | - |
3 | | -Welcome to the **Sloopstash CTM app**, which includes both the backend and frontend components. This guide will walk you through the setup process to run the application locally. |
4 | | - |
5 | | -## Project Structure |
6 | | - |
7 | | -The project consists of two main folders: |
8 | | - |
9 | | -- **backend**: Node.js backend API for the CTM app. |
10 | | -- **frontend**: React frontend for the CTM app. |
11 | | - |
12 | | -## Prerequisites |
13 | | - |
14 | | -Before you start, ensure that you have the following installed: |
15 | | - |
16 | | -- [Node.js](https://nodejs.org/) (v14 or later) |
17 | | - - **Installation for Node.js**: |
18 | | - - Visit the official [Node.js website](https://nodejs.org/) and download the latest stable version (LTS). Follow the installation instructions specific to your operating system (Windows, macOS, or Linux). |
19 | | - - You can verify the installation by running the following commands in your terminal or command prompt: |
20 | | - ```bash |
21 | | - node -v |
22 | | - npm -v |
23 | | - ``` |
24 | | - If both commands return a version number, Node.js and npm (Node Package Manager) are successfully installed. |
25 | | - |
26 | | -- [MongoDB](https://www.mongodb.com/) (running locally or remotely) |
27 | | - - If you want to run MongoDB locally, install it from [MongoDB's official site](https://www.mongodb.com/try/download/community) and follow the instructions for your OS. |
28 | | - - Alternatively, you can use [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) for a cloud-based solution. |
29 | | -
|
30 | | -## Backend Setup |
31 | | -
|
32 | | -The backend of this application is built with **Node.js** and **Express**. Follow these steps to get the backend running locally. |
33 | | -
|
34 | | -### Steps: |
35 | | -
|
36 | | -1. **Navigate to the `backend` folder**: |
37 | | - ```bash |
38 | | - cd sloopstash/backend |
39 | | - ``` |
40 | | -
|
41 | | -2. **Create a `.env` file** for local configuration: |
42 | | - ```bash |
43 | | - touch .env |
44 | | - ``` |
45 | | -
|
46 | | -3. **Add the following environment variables** to the `.env` file: |
47 | | - ```env |
48 | | - MONGO_URI=mongodb://localhost:27017/ctm |
49 | | - JWT_SECRET=your_secret_key_here |
50 | | - ``` |
51 | | -
|
52 | | - - `MONGO_URI`: The MongoDB connection string for your database. |
53 | | - - `JWT_SECRET`: Secret key used to sign JWT tokens for authentication. |
54 | | -
|
55 | | -4. **Install dependencies**: |
56 | | - ```bash |
57 | | - npm install |
58 | | - ``` |
59 | | -
|
60 | | -5. **Start the backend server**: |
61 | | -
|
62 | | - - This command will use **nodemon** to run the server. Make sure you have **nodemon** installed globally if you don't have it already: |
63 | | - ```bash |
64 | | - npm install -g nodemon |
65 | | - ``` |
66 | | - |
67 | | - ```bash |
68 | | - npm run dev |
69 | | - ``` |
70 | | - |
71 | | -The backend should now be running on [http://localhost:2000](http://localhost:2000). |
72 | | - |
73 | | - |
74 | | -## Frontend Setup |
75 | | - |
76 | | -The frontend is built with **React**. Follow these steps to get the frontend running locally. |
77 | | - |
78 | | -### Steps: |
79 | | - |
80 | | -1. **Navigate to the `frontend` folder**: |
81 | | - ```bash |
82 | | - cd sloopstash/frontend |
83 | | - ``` |
84 | | - |
85 | | -2. **Create a `.env` file** for local configuration: |
86 | | - ```bash |
87 | | - touch .env |
88 | | - ``` |
89 | | - |
90 | | -3. **Add the following environment variable** to the `.env` file: |
91 | | - ```env |
92 | | - BACKEND_BASE_URL=http://localhost:2000/api |
93 | | - ``` |
94 | | - |
95 | | - - `BACKEND_BASE_URL`: The URL to the backend API. This allows the frontend to make API requests to the backend. |
96 | | - |
97 | | -4. **Install dependencies**: |
98 | | - ```bash |
99 | | - npm install |
100 | | - ``` |
101 | | - |
102 | | -5. **Start the frontend development server**: |
103 | | - ```bash |
104 | | - npm start |
105 | | - ``` |
106 | | - |
107 | | -The frontend should now be running on [http://localhost:3000](http://localhost:3000). |
108 | | - |
109 | | -## Additional Notes |
110 | | - |
111 | | -- **MongoDB**: Make sure you have **MongoDB** running locally on your machine. If not, you can install it from [MongoDB's official site](https://www.mongodb.com/try/download/community) or use a cloud-based MongoDB service like [MongoDB Atlas](https://www.mongodb.com/cloud/atlas). |
112 | | - |
113 | | -- **Development Setup**: The app is set up for local development. If you encounter any issues with missing dependencies or errors during setup, try deleting the `node_modules` folder and running `npm install` again. |
114 | | -
|
115 | | -- **Port Customization**: If you want to change the backend port or database URI, you can modify the `.env` files in both the frontend and backend directories accordingly. |
116 | | -
|
117 | | -- **Future Updates**: **Containerization** work using **Docker** is ongoing and will be available in future releases. Once containerization is complete, you will be able to run the app using Docker and Docker Compose. |
118 | | -
|
119 | | -## License |
120 | | -
|
121 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
122 | | -
|
123 | | ---- |
124 | | -
|
125 | | -**Thank you for using the Sloopstash CTM app!** |
| 1 | +# Sloopstash CTM app, |
| 2 | +Welcome to the Sloopstash CTM app, which includes both the backend and frontend components. This guide will walk you through the setup process to run the containerized application. |
0 commit comments