Skip to content

Commit 513d8fb

Browse files
committed
first working version
1 parent ba7a3c1 commit 513d8fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+14938
-1
lines changed

.dockerignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.git
2+
*/node_modules
3+
Dockerfile*
4+
docker-compose*
5+
.dockerignore
6+
.git
7+
.gitignore
8+
README.md

.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "06:00"
8+
timezone: Europe/London
9+
open-pull-requests-limit: 99

.github/workflows/main.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
node-version: ["14"]
17+
os: [ubuntu-latest]
18+
19+
steps:
20+
- name: Check out repository
21+
uses: actions/checkout@v2
22+
23+
- name: Use Node.js ${{ matrix.node_version }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node_version }}
27+
28+
- name: Install, build and test
29+
run: |
30+
yarn install --frozen-lockfile
31+
yarn build:frontend
32+
yarn test
33+
34+
env:
35+
CI: true

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ node_modules
55
.vscode
66
npm-debug.log*
77
yarn-debug.log*
8-
yarn-error.log*
8+
yarn-error.log*
9+
10+
# builds
11+
packages/coins-frontend/build

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages/coins-frontend/build

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:16-alpine
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY package.json package.json
6+
COPY packages/coins-frontend/package.json packages/coins-frontend/package.json
7+
COPY packages/coins-models/package.json packages/coins-models/package.json
8+
COPY packages/coins-server/package.json packages/coins-server/package.json
9+
COPY packages/coins-utils/package.json packages/coins-utils/package.json
10+
11+
COPY yarn.lock yarn.lock
12+
13+
RUN yarn install --frozen-lockfile
14+
15+
COPY packages packages
16+
17+
CMD ["yarn", "server:start"]

README.md

+102
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,108 @@
44
<p align="center">simple and easy to track your crypto.<p>
55
</p>
66

7+
### Preview
8+
9+
[see live version here](https://coins.domnc.app)
10+
11+
The current production build is served by [vercel.com](https://vercel.com)
12+
13+
```http
14+
https://coins.domnc.app
15+
```
16+
17+
## Getting Started
18+
19+
### Prerequisites
20+
21+
I build this entire project with the following setup:
22+
23+
- macOS Big Sur version 11.5 Beta
24+
- node v16.2.0
25+
- npm 7.13.0
26+
- yarn v1.22.10
27+
- Docker version 20.10.6, build 370c289
28+
29+
---
30+
31+
### Development
32+
33+
1. create your `.env` file based on the `.env.example`
34+
35+
2. install all necessary dependencies
36+
37+
```bash
38+
yarn install
39+
```
40+
41+
3. start frontend
42+
43+
```bash
44+
yarn start:dev:frontend
45+
```
46+
47+
4. start server
48+
49+
```bash
50+
yarn start:dev:server
51+
```
52+
53+
---
54+
55+
## Production
56+
57+
1. create your `.env` file based on the `.env.example`
58+
59+
2. build docker application
60+
61+
```bash
62+
docker-compose --env-file packages/coins-server/.env build
63+
```
64+
65+
3. start docker application
66+
67+
```bash
68+
docker-compose --env-file packages/coins-server/.env up
69+
```
70+
71+
4. stop docker application
72+
73+
```bash
74+
docker-compose --env-file packages/coins-server/.env down
75+
```
76+
77+
---
78+
79+
## Commands
80+
81+
Update application
82+
83+
```bash
84+
sh scripts/release-task
85+
```
86+
87+
Import coins data from external API
88+
89+
```bash
90+
sh scripts/run-import-coins.sh
91+
```
92+
93+
---
94+
95+
## Job tasks
96+
97+
Import coins data from external API
98+
99+
```bash
100+
NODE_ENV=production yarn workspace coins-server ts-node --transpile-only ./src/tasks/run-import-coins.ts *OPTIONAL_PAGE*
101+
```
102+
103+
crontab example
104+
105+
```bash
106+
*/10 * * * * cd /coins && bash scripts/run-import-coins.sh >/dev/null 2>&1
107+
```
108+
7109
---
8110

9111
## LICENSE

docker-compose.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: "3.8"
2+
3+
services:
4+
mongo:
5+
container_name: cryptocurrencies-mongo
6+
image: mongo
7+
restart: unless-stopped
8+
networks:
9+
- cryptocurrencies-network
10+
volumes:
11+
- mongo-data:/data/db
12+
ports:
13+
- ${MONGO_PORT}:27017
14+
15+
redis:
16+
container_name: cryptocurrencies-redis
17+
image: redis:alpine
18+
command: redis-server --requirepass ${REDIS_PASS}
19+
restart: unless-stopped
20+
networks:
21+
- cryptocurrencies-network
22+
volumes:
23+
- redis-data:/data
24+
- redis-dump:/var/lib/redis
25+
ports:
26+
- ${REDIS_PORT}:6379
27+
28+
server:
29+
container_name: cryptocurrencies-server
30+
build: .
31+
environment:
32+
- MONGO_HOST=mongodb://mongo:27017/cryptocurrencies
33+
- REDIS_HOST=redis://cryptocurrencies-redis/?password=${REDIS_PASS}
34+
depends_on:
35+
- mongo
36+
- redis
37+
restart: unless-stopped
38+
networks:
39+
- cryptocurrencies-network
40+
ports:
41+
- ${PORT}:${PORT}
42+
43+
networks:
44+
cryptocurrencies-network:
45+
driver: bridge
46+
47+
volumes:
48+
mongo-data:
49+
redis-data:
50+
redis-dump:

package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "coins",
3+
"version": "0.0.1",
4+
"license": "UNLICENSED",
5+
"private": true,
6+
"author": "Dominic Kolbe <kolbedominic@gmail.com>",
7+
"repository": "git@github.com:dominickolbe/coins.git",
8+
"workspaces": [
9+
"packages/coins-frontend",
10+
"packages/coins-models",
11+
"packages/coins-server",
12+
"packages/coins-utils"
13+
],
14+
"scripts": {
15+
"frontend:start": "REACT_APP_VERSION=$npm_package_version yarn workspace coins-frontend start",
16+
"frontend:build": "REACT_APP_VERSION=$npm_package_version yarn workspace coins-frontend build",
17+
"server:dev": "REACT_APP_VERSION=$npm_package_version yarn workspace coins-server start:dev",
18+
"server:start": "REACT_APP_VERSION=$npm_package_version yarn workspace coins-server start",
19+
"prettier:check": "prettier --check packages/**/*",
20+
"prettier:fix": "prettier --write packages/**/*",
21+
"test": "yarn run prettier:check"
22+
},
23+
"dependencies": {},
24+
"devDependencies": {
25+
"typescript": "^4.3.2",
26+
"prettier": "^2.3.0"
27+
}
28+
}

packages/coins-frontend/.env.example

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# APP
2+
3+
REACT_APP_NAME=
4+
REACT_APP_API_URL=
5+
6+
# GOOGLE ANALYTICS
7+
8+
REACT_APP_GA_TRACKING_ID=

packages/coins-frontend/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# coins-frontend

packages/coins-frontend/package.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "coins-frontend",
3+
"version": "1.0.0",
4+
"license": "UNLICENSED",
5+
"private": true,
6+
"scripts": {
7+
"start": "REACT_APP_BUILD_TIME=$(date '+%x %X') react-scripts start",
8+
"build": "REACT_APP_BUILD_TIME=$(date '+%x %X') react-scripts build"
9+
},
10+
"dependencies": {
11+
"@coingecko/cryptoformat": "^0.4.2",
12+
"@emotion/css": "^11.1.3",
13+
"@material-ui/core": "^4.11.4",
14+
"@material-ui/icons": "^4.11.2",
15+
"@material-ui/lab": "^4.0.0-alpha.58",
16+
"@material-ui/styles": "^4.11.4",
17+
"axios": "^0.21.1",
18+
"lodash": "^4.17.21",
19+
"option-t": "^27.1.0",
20+
"overmind": "^27.0.0",
21+
"overmind-react": "^28.0.0",
22+
"react": "^17.0.2",
23+
"react-dom": "^17.0.2",
24+
"react-ga": "^3.3.0",
25+
"react-router-dom": "^5.2.0",
26+
"react-scripts": "^4.0.3",
27+
"react-use": "^17.2.4",
28+
"runtypes": "^6.3.0"
29+
},
30+
"devDependencies": {
31+
"@types/axios": "^0.14.0",
32+
"@types/lodash": "^4.14.170",
33+
"@types/node": "^15.6.1",
34+
"@types/react": "^17.0.8",
35+
"@types/react-dom": "^17.0.5",
36+
"@types/react-router-dom": "^5.1.7",
37+
"typescript": "^4.3.2"
38+
},
39+
"eslintConfig": {
40+
"extends": [
41+
"react-app"
42+
]
43+
},
44+
"browserslist": {
45+
"production": [
46+
">0.2%",
47+
"not dead",
48+
"not op_mini all"
49+
],
50+
"development": [
51+
"last 1 chrome version",
52+
"last 1 firefox version",
53+
"last 1 safari version"
54+
]
55+
}
56+
}
23 KB
Loading
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<link rel="icon" href="%PUBLIC_URL%/favicon.jpg" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#171C24" />
9+
<meta name="description" content="simple and easy to track your crypto." />
10+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.jpg" />
11+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
12+
<title>%REACT_APP_NAME%</title>
13+
<link rel="preconnect" href="https://fonts.gstatic.com" />
14+
<link
15+
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap"
16+
rel="stylesheet"
17+
/>
18+
</head>
19+
<body>
20+
<noscript>You need to enable JavaScript to run this app.</noscript>
21+
<div id="root"></div>
22+
</body>
23+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "coins",
3+
"name": "coins",
4+
"icons": [
5+
{
6+
"src": "favicon.jpg",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#171C24",
14+
"background_color": "#171C24"
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

0 commit comments

Comments
 (0)