Skip to content

Commit

Permalink
feature: Api Server (#43)
Browse files Browse the repository at this point in the history
* feature: Api Server

* Add frontend

* Release 4.10.0-dev.16

* Handle static file properly

* Release 4.10.0-dev.17

* Fix handle static files properly

* Release 4.10.0-dev.18

* Code review; Use Suspense

* Load lazy properly

* Improve lazy loading

* Release 4.10.0-dev.19

* Release 4.10.0-dev.19

* Validate jwt token expiration

* Performance improvements; Remove axios

* Release 4.10.0-dev.21

* Guild APIs progress

* reformat code

* Progress on guild details page

* Improve lazy loading

* Guild features summary

* Proper cors handling; Extend Guild details page

* Release 4.10.0-dev.22

* Implement pagination

* Release 4.10.0-dev.23

* format

* Code review

* Release 4.10.0-dev.24

* Release 4.10.0-dev.25

* Fix pagination

* Reqquire Jwt

* Release 4.10.0-dev.26

* Fetch user avatar and username

* Trailing new lines

* Add api call response cache

* Add eslint?

* Release 4.10.0-dev.27

* Add rate limiter

* Add cli; Add guild reminder endpoint; Refactor code

* Implement reminders panel

* Release 4.10.0-dev.28

* Add FeatureData element

* Allow server admins access their server dashboard

* Refactor protected elements handlingg

* Form Dialog

* Add loading state

* Rework filters
  • Loading branch information
l7ssha authored Jan 31, 2025
1 parent 4d87cc6 commit bdfa4a6
Show file tree
Hide file tree
Showing 65 changed files with 20,580 additions and 589 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ build/
.idea/

lib_old/

**/node_modules/**
6 changes: 5 additions & 1 deletion .github/workflows/publish_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ jobs:
context: .
target: prod
push: true
build-args: |
REACT_APP_CLIENT_ID=${{ secrets.REACT_APP_CLIENT_ID }}
REACT_APP_REDIRECT_URL=${{ secrets.REACT_APP_REDIRECT_URL }}
REACT_APP_API_SERVER=${{ secrets.REACT_APP_API_SERVER }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Redeploy portainer
uses: muinmomin/[email protected]
with:
url: ${{ secrets.ROD_PORTAINER_WEBHOOK }}
url: ${{ secrets.ROD_PORTAINER_WEBHOOK }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ doc/api/
*.db

sessions/

public/
!public/.gitkeep
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,29 @@ FROM build AS build_prod

RUN dart run nyxx_commands:compile bin/running_on_dart.dart -o bot

FROM node:lts-slim as build_frontend

ARG REACT_APP_CLIENT_ID
ARG REACT_APP_REDIRECT_URL
ARG REACT_APP_API_SERVER

ENV REACT_APP_CLIENT_ID=$REACT_APP_CLIENT_ID
ENV REACT_APP_REDIRECT_URL=$REACT_APP_REDIRECT_URL
ENV REACT_APP_API_SERVER=$REACT_APP_API_SERVER

WORKDIR /app

COPY ./frontend/ /app

RUN npm install
RUN npm run build

FROM scratch AS prod

WORKDIR /app

COPY --from=build_prod /runtime /
COPY --from=build_prod /app/templates /app/templates
COPY --from=build_prod /app/bot.exe /app
COPY --from=build_frontend /app/build /app/public

CMD [ "./bot.exe" ]
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ run: ## Run dev project
upgrade: ## Run dart pub upgrade
dart pub upgrade

build-frontend-dev: ## Build dev frontend
cd frontend/; env-cmd -f .env.development.local yarn build
cp -r frontend/build/** public/

fix-project: fix analyze format ## Fix whole project

check-project: fix-project tests ## Run all checks
7 changes: 5 additions & 2 deletions bin/running_on_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import 'package:nyxx_commands/nyxx_commands.dart';
import 'package:nyxx_extensions/nyxx_extensions.dart';
import 'package:running_on_dart/running_on_dart.dart';

void main() async {
void main(List<String> args) async {
if (handleCli(args)) {
return;
}

final commands = CommandsPlugin(
prefix: null,
guild: devGuildId,
Expand Down Expand Up @@ -43,7 +47,6 @@ void main() async {
IgnoreExceptions(),
commands,
pagination,
SessionManagerPlugin(),
],
));

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.9'
services:
running_on_dart:
image: ghcr.io/nyxx-discord/running_on_dart:4.10.0-dev.15
image: ghcr.io/nyxx-discord/running_on_dart:4.10.0-dev.28
container_name: running_on_dart
env_file:
- .env
depends_on:
- db
volumes:
- "rod_sessions:/sessions"
networks:
- internal
- nginx-proxy_default
Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ services:
- "8088:8088"
depends_on:
- db
volumes:
- "./sessions:/sessions"
- "./templates:/templates"

db:
image: postgres:17
Expand Down
26 changes: 26 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.idea/
*.iml

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Loading

0 comments on commit bdfa4a6

Please sign in to comment.