Skip to content

Commit d142af0

Browse files
committed
Initial commit: Simple Bad Word Checker API
- Implement basic API for bad word checking - Set up Docker and Go Echo framework - Add README with project description and setup instructions - Include MIT License
0 parents  commit d142af0

21 files changed

+557
-0
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
coverage.txt
3+
_test
4+
vendor
5+
.idea
6+
*.iml
7+
*.out
8+
.vscode

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM golang:1.22.4 AS builder
2+
3+
ENV GO111MODULE=on \
4+
CGO_ENABLED=0 \
5+
GOOS=linux \
6+
GOARCH=amd64
7+
8+
WORKDIR /build
9+
10+
COPY go.mod .
11+
COPY go.sum .
12+
RUN go mod download
13+
14+
COPY . .
15+
16+
RUN go build -o main .
17+
18+
FROM alpine:latest
19+
RUN adduser -D appuser
20+
USER appuser
21+
22+
WORKDIR /app
23+
24+
COPY --from=builder /build/main .
25+
26+
EXPOSE 8089
27+
28+
CMD ["./main"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Arnon Sang-ngern
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Define variables
2+
APP_NAME = simple-badwords-api
3+
DOCKER_COMPOSE_FILE = docker-compose.yml
4+
5+
# Build the Docker image
6+
build:
7+
docker-compose -f $(DOCKER_COMPOSE_FILE) build
8+
9+
# Run the application using Docker Compose
10+
up:
11+
docker-compose -f $(DOCKER_COMPOSE_FILE) up
12+
13+
# Run the application in detached mode
14+
up-detached:
15+
docker-compose -f $(DOCKER_COMPOSE_FILE) up -d
16+
17+
# Stop and remove the containers
18+
down:
19+
docker-compose -f $(DOCKER_COMPOSE_FILE) down
20+
21+
# Remove the Docker image
22+
clean:
23+
docker-compose -f $(DOCKER_COMPOSE_FILE) down --rmi all
24+
25+
# Restart the application
26+
restart: down up
27+
28+
# Tail the logs of the running containers
29+
logs:
30+
docker-compose -f $(DOCKER_COMPOSE_FILE) logs -f
31+
32+
# Show the status of the running containers
33+
status:
34+
docker-compose -f $(DOCKER_COMPOSE_FILE) ps

README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<div align="center">
2+
3+
# Simple Bad Word Checker
4+
5+
![Logo](static/favicon-32x32.png)
6+
7+
A simple and lightweight API for filtering and checking bad words, built with [Go](https://go.dev/) and [Echo](https://echo.labstack.com/).
8+
9+
[Features](#🌟-features)[Usage](#🚀-usage)[Installation](#💻-installation)[API](#api-endpoints)[Contributing](#contributing)[Acknowledgments](#acknowledgments)[License](#license)
10+
11+
![Screenshot](static/screenshot.png)
12+
13+
</div>
14+
15+
## 🌟 Features
16+
17+
- 📋 Retrieve a comprehensive list of bad words via API
18+
- ✅ Check if a specific word is considered inappropriate
19+
- 🌐 User-friendly web interface for easy testing and usage
20+
- 🐳 Docker support for simple deployment
21+
22+
## 🚀 Usage
23+
24+
### API Endpoints
25+
26+
- **GET** `/healthz`: Check service health
27+
- **GET** `/api/words`: Get the list of bad words
28+
- **GET** `/api/words/:word`: Verify if a specific word is considered inappropriate
29+
- **GET** `/api/sentence/:sentence`: Check if a sentence contains bad words
30+
31+
### Web Interface
32+
33+
Access the intuitive web interface by navigating to [badword.iamickdev.com](https://badwords.iamickdev.com)
34+
35+
## 💻 Installation
36+
37+
1. Clone this repository:
38+
```bash
39+
git clone https://github.com/arnonsang/badwords.git
40+
```
41+
2. Navigate to the project directory:
42+
```bash
43+
cd your_project_dir
44+
```
45+
3. Build and run via docker compose:
46+
```bash
47+
docker-compose up -d
48+
```
49+
4. Access the application at `http://localhost:8089` in your browser.
50+
51+
## Makefile Commands
52+
53+
| Command | Description |
54+
|---------|-------------|
55+
| `make build` | Builds the Docker image |
56+
| `make up` | Starts the application using Docker Compose |
57+
| `make up-detached` | Starts the application in detached mode |
58+
| `make down` | Stops and removes the containers |
59+
| `make clean` | Removes the Docker image |
60+
| `make restart` | Restarts the application |
61+
| `make logs` | Tails the logs of the running containers |
62+
| `make status` | Shows the status of the running containers |
63+
64+
## Dependencies
65+
66+
- [Go](https://golang.org/) - The programming language powering the server
67+
- [Echo](https://echo.labstack.com/) - High performance, extensible, minimalist Go web framework
68+
- [Tailwind CSS](https://tailwindcss.com/) - A utility-first CSS framework for rapid UI development
69+
70+
## Project Structure
71+
```bash
72+
├── assets
73+
│ └── badwords.go
74+
├── docker-compose.yml
75+
├── Dockerfile
76+
├── go.mod
77+
├── go.sum
78+
├── main.go
79+
├── Makefile
80+
├── presentation
81+
│ └── server.go
82+
├── README.md
83+
├── static
84+
│ ├── android-chrome-192x192.png
85+
│ ├── android-chrome-512x512.png
86+
│ ├── apple-touch-icon.png
87+
│ ├── favicon-16x16.png
88+
│ ├── favicon-32x32.png
89+
│ ├── favicon.ico
90+
│ ├── index.html
91+
│ ├── screenshot.png
92+
│ └── site.webmanifest
93+
└── usecase
94+
└── badwords.go
95+
```
96+
97+
## Contributing
98+
99+
Contributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/arnonsang/badwords/issues) or open [pull request](https://github.com/arnonsang/badwords/pulls).
100+
101+
## License
102+
103+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
104+
105+
## Acknowledgments
106+
107+
We'd like to tip our hats to:
108+
109+
- The awesome folks at **[favicon.io](https://favicon.io/favicon-generator/)** for their fantastic favicon generator. It's made our app look snazzy!
110+
- The brilliant minds at **[Carnegie Mellon University](https://www.cs.cmu.edu/~biglou/resources/bad-words.txt)** for providing a comprehensive list of bad words. Your work helps keep the internet a little cleaner!
111+
112+
Your resources have been invaluable in making this project shine. Thank you! 🌟
113+
114+
## Author
115+
116+
Made with ❤️ by **[iamickdev](https://www.iamickdev.com)**
117+
- Website: [www.iamickdev.com](https://www.iamickdev.com)
118+
- Github: [@arnonsang](https://github.com/arnonsang)
119+
120+
---
121+
122+
**From JLR Lab**
123+
*A Gen Z technology research, consulting and development team based in Thailand.*
124+

0 commit comments

Comments
 (0)