⭐ For API we are using GIN
http server.
⭐ We have demonstrated how to use security related headers
for the endpoints.
⭐ Used FULL-TEXT search indexing using FTS4 module to filter audio data faster.
⭐ APP ensure security with statefull HMAC SHA256 JWT tokens.
⭐ Included FFmpeg
lib for proper STT service input. The app supports these media type as file input: mp2, mp3, mp4, wav, acc, flac, avi, ogg
⭐ Set-up docker-compose
for easier deployments.
⭐ Set-up GitHub actions
for CI purposes.
⭐ Included TEST
suites
⭐ Included POSTMAN
collections for easier testing.
DEMO app:
https://protected-mountain-13923.herokuapp.com/
- HTTP configurations (port, database-path) are in the toml file:
./conf.d/app.toml
We are taking following measures to ensure API security.
- Setting up CORS security headers.
- Setting up the 'attack-vector' headers
Implemented statefull HMAC SHA256 JWT tokens verifications.
//setting-up cors headers
r.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"GET"},
AllowHeaders: []string{"Origin"},
ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true,
MaxAge: 12 * time.Hour,
}))
//setting-up security headers
r.Use(secure.New(secure.Config{
FrameDeny: true,
ContentTypeNosniff: true,
BrowserXssFilter: true,
ContentSecurityPolicy: "default-src 'self'",
IENoOpen: true,
ReferrerPolicy: "strict-origin-when-cross-origin",
//SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
}))
go build -o stt-service
./stt-service
go clean -testcache
go test ./...
nodemon -e js,go,json,html,css,toml --exec go run main.go --signal SIGTERM
- Use the POSTMAN collection JSON config and test there or you can use CURL.
- Login and audio text searching is available.
curl -X POST -d [options] http://127.0.0.1:5000/login
OPTIONS: user=a pass=a
curl -X POST -d [options] http://127.0.0.1:5000/register
OPTIONS: user=a pass=a [email protected]
curl -X POST -d [options] http://127.0.0.1:5000/transcribe
OPTIONS: token=<token> file=<file> is_save_file=<true/false>
curl -X POST -d [options] http://127.0.0.1:5000/all-data
OPTIONS: token=<token> page_no=1
curl -X POST -d [options] http://127.0.0.1:5000/filter
OPTIONS: token=<token> page_no=1 query=<search_term>
docker-compose up
1. Install Docker
2. Install Heroku cli
3. Create a Heroku project
4. Run docker container locally. Then run these commands:
- heroku login
- heroku container:login
- heroku create
- heroku container:push web
- heroku container:release web
- heroku open
- Create and run unimplemented test suites.
- Config GitHub actions to run properly.
- Admin panel used in the UI: https://adminlte.io/
- GIN API documentations: https://github.com/gin-gonic/gin#readme