Skip to content

Commit 99f9565

Browse files
authored
Create README.md
1 parent e847340 commit 99f9565

File tree

1 file changed

+208
-0
lines changed

1 file changed

+208
-0
lines changed

README.md

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# BLOG WEB APPLICATION
2+
3+
The application allows users to read blog posts, login or signup to like a post, and for staff/admin to manage posts and users. If you have a passion for writing and sharing your thoughts, this app is for you.
4+
5+
While the code may not be perfect and may still contain bugs, the goal is to provide a practical, hands-on experience in building a real-world application. Your feedback and contributions are always welcome.
6+
7+
## 🌟 Features
8+
9+
- **User Authentication**: Secure authentication using JWT tokens for user login and signup.
10+
11+
- **Blog Reading**: Users can read blog posts and view details about each post.
12+
13+
- **Interaction**: Users can like posts to engage with the content.
14+
15+
- **User Management**: Staff/Admin can manage user accounts, including adding, updating users.
16+
17+
- **Post Management**: Staff/Admin members can create, edit, or delete blog posts.
18+
19+
## 📌 Tech Stack Versions
20+
Please note that the versions listed below are the ones used during the development of this application. The application may work with other versions as well, but these are the ones that have been tested and confirmed to work.
21+
22+
- **Java**: 17
23+
24+
- **Spring Boot**: 3.2.5
25+
26+
- **JWT**: 0.11.5
27+
28+
- **MySQL**: 8.0
29+
30+
- **Angular CLI**: 16.2.10
31+
32+
- **Node.js**: 18.20.2
33+
34+
- **npm**: 10.5.0
35+
36+
- **PrimeNG**: 17.15.0
37+
38+
- **Electron**: 30.0.2
39+
40+
- **Capacitor**: 6.0.0
41+
42+
43+
## ⚙️ Configuration
44+
45+
The application can be configured by modifying the [application.properties](https://github.com/56duong/angular-springboot-blog-webapp/blob/master/backend/src/main/resources/application.properties) file and the [config.ts](https://github.com/56duong/angular-springboot-blog-webapp/blob/master/frontend/src/app/core/config/config.ts) file in your JavaScript project. Here are some of the configurations you might need to change:
46+
47+
- **Database Connection**: Update the `spring.datasource.url`, `spring.datasource.username`, and `spring.datasource.password` properties in the `application.properties` file to match your own database connection details. You can choose to connect to a local database or an Azure database.
48+
49+
```properties
50+
#localhost
51+
spring.datasource.url=jdbc:mysql://your-localhost-database-url:3306/your-database-name?createDatabaseIfNotExist=true
52+
spring.datasource.username=your-localhost-username
53+
spring.datasource.password=your-localhost-password
54+
55+
#azure
56+
spring.datasource.url=jdbc:mysql://your-azure-database-url:3306/your-database-name?useSSL=true
57+
spring.datasource.username=your-azure-username
58+
spring.datasource.password=your-azure-password
59+
```
60+
61+
62+
- **API URL**: In your `config.ts` file, change the API URL to your own API URL as follows:
63+
64+
```javascript
65+
// localhost
66+
export const API_URL = 'http://your-localhost-api-url';
67+
68+
// azure
69+
export const API_URL = 'https://your-azure-api-url';
70+
```
71+
72+
73+
## 🚀 Getting Started
74+
75+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
76+
77+
1. Clone the repository: `git clone https://github.com/56duong/angular-springboot-blog-webapp.git`
78+
79+
2. Navigate to the project directory: `cd angular-springboot-blog-webapp`
80+
81+
82+
### Database
83+
84+
3. Run the Project:
85+
Ensure your project is running to allow DDL auto to create the necessary tables in your database.
86+
87+
4. Import TSV Data:
88+
- In IntelliJ IDEA's Database tool, find the `role` table, right-click, and choose "Import Data From File".
89+
90+
- Select the TSV file containing role data, map columns, and confirm import.
91+
92+
- Note: Import data for the `role` table before proceeding to the `user` table.
93+
94+
- After importing data for the `role` table, find the `user` table, right-click, and select "Import Data From File".
95+
96+
- Choose the TSV file containing user data, map columns, and confirm import.
97+
98+
99+
### Backend
100+
101+
5. Navigate to the backend directory: `cd backend`
102+
103+
6. Install dependencies: `mvn install`
104+
105+
7. Run the application: `mvn spring-boot:run`
106+
107+
108+
### Frontend
109+
110+
8. Navigate to the frontend directory: `cd frontend`
111+
112+
9. Install dependencies: `npm install`
113+
114+
10. Run the application: `npm start`
115+
116+
117+
## 🔧 Build and Deployment
118+
119+
**1. Deploy MySQL Database to Azure**: Watch my [video]() for setup.
120+
121+
**2. Angular Build and Copy Files to `resources/static`**:
122+
123+
- Use the Angular CLI to build your project with the command `ng build`.
124+
125+
- Then, copy the output files to the `resources/static` directory in your Spring Boot project.
126+
127+
**3. Docker Build and Push to Docker Hub**: Use Docker to build an image of your application and then push it to Docker Hub.
128+
```bash
129+
docker build -t your-dockerhub-username/your-image-name .
130+
131+
docker push your-dockerhub-username/your-image-name
132+
```
133+
134+
**4. Deploy Container to Azure**: Watch my [video]() for setup.
135+
136+
**5. Mobile App Export**: Use Capacitor to prepare your app for mobile app.
137+
138+
- First, ensure that your `capacitor.config.json` file is properly configured. If not, delete it and create a new one using `npx cap init`.
139+
140+
- Next, install the necessary Capacitor packages:
141+
```bash
142+
# For Android
143+
npm i @capacitor/android
144+
145+
# For iOS
146+
npm i @capacitor/ios
147+
```
148+
149+
- Then, add Android and iOS as platforms to your Capacitor project:
150+
```bash
151+
# For Android
152+
npx cap add android
153+
154+
# For iOS
155+
npx cap add ios
156+
```
157+
158+
- Sync your project:
159+
```bash
160+
npx cap sync
161+
```
162+
163+
- Finally, open your project in Android Studio and Xcode to generate the APK and IPA files respectively:
164+
```bash
165+
# For Android
166+
npx cap open android
167+
168+
# For iOS
169+
npx cap open ios
170+
```
171+
172+
- In Android Studio, use the "Generate Signed Bundle / APK" option in the "Build" menu to export your Android app. In Xcode, use the "Product" -> "Archive" option to export your iOS app.
173+
174+
- **Note**: When you run the npx cap sync command, Capacitor copies the built web assets (the output of your npm run build command) into each platform's native project. For Android, these assets are copied to `android/app/src/main/assets/public`. For iOS, they are copied to `ios/App/App/public`. This ensures that the latest version of your web app is included in the native project each time you build it.
175+
176+
**6. Windows App Export**:
177+
- Build your Electron app:
178+
```bash
179+
npm run electron-build
180+
```
181+
182+
- Package your app with Electron Packager: This will generate a folder named PostShare-win32-x64 in the project root directory, which contains the Windows executable (.exe) file.
183+
```bash
184+
electron-packager ./ PostShare --platform=win32
185+
```
186+
187+
Please replace the `PostShare` with your actual app name if it's different.
188+
189+
- Delete all folders inside `PostShare-win32-x64/resources/app` except for the `dist` folder. Note: Only delete folders, do not delete any files.
190+
191+
- Use Inno Setup to create an installer for your app. Watch my [video]() for setup.
192+
193+
194+
## :wave: Who i am?
195+
196+
A young developer, who dedicated to developing usable apps, not just 'homework apps'.
197+
198+
I delight in sharing my knowledge and experiences, hoping to inspire others to embark on their own journey in application development. Also, I have a fondness for sour soup :bowl_with_spoon:.
199+
200+
201+
## License
202+
203+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/56duong/angular-springboot-blog-webapp/blob/master/LICENSE) file for details.
204+
205+
206+
## Contact
207+
208+
If you want to contact me you can reach me at <56duong@gmail.com>. If you'd like to contribute, please fork the repository and use a pull request for changes.

0 commit comments

Comments
 (0)