Skip to content

Commit

Permalink
feat: service implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
FairyFromAlfeya committed Sep 18, 2022
1 parent 57dc74c commit 35b28f4
Show file tree
Hide file tree
Showing 56 changed files with 7,862 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PORT=3000

DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=oracle-backend
DB_USERNAME=oracle-backend
DB_PASSWORD=oracle-backend

EVERCLOUD_URL=https://mainnet.evercloud.dev/9de6d46bd6454e6cac0b43aa7c7eaed6/graphql
TWAP_INTERVALS=300,600,900,1800
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir : __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:16.17.0-alpine

RUN apk add --no-cache make python3 git

WORKDIR /app

# Sources
COPY src /app/src

# Install
COPY package.json /app/package.json
COPY yarn.lock /app/yarn.lock

# Config
COPY ormconfig.js /app/ormconfig.js
COPY tsconfig.json /app/tsconfig.json
COPY tsconfig.build.json /app/tsconfig.build.json

# Build
RUN yarn
RUN yarn build

# Clean
RUN rm -rf /app/yarn.lock
RUN rm -rf /app/tsconfig.json
RUN rm -rf /app/tsconfig.build.json
RUN rm -rf /app/src

EXPOSE 3000

CMD yarn start:prod
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# oracle-backend
Backend for FlatQube oracle-pairs indexing
5 changes: 5 additions & 0 deletions nest-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src"
}
11 changes: 11 additions & 0 deletions ormconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
type: 'postgres',
host: process.env.DB_HOST,
port: process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
entities: ['dist/**/*.entity{.ts,.js}'],
migrations: ['dist/**/*.migration{.ts,.js}'],
migrationsRun: true,
};
81 changes: 81 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"name": "oracle-backend",
"version": "0.0.1",
"description": "Backend for FlatQube oracle-pairs indexing",
"author": "Alexander Kunekov<[email protected]>",
"private": true,
"license": "MIT",
"scripts": {
"prepare": "husky install",
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start:dev": "nest start --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
},
"dependencies": {
"@nestjs/common": "9.0.0",
"@nestjs/config": "2.2.0",
"@nestjs/core": "9.0.0",
"@nestjs/event-emitter": "1.3.1",
"@nestjs/platform-express": "9.0.0",
"@nestjs/typeorm": "8.0.3",
"bignumber.js": "9.1.0",
"everscale-inpage-provider": "0.3.41",
"everscale-standalone-client": "2.1.1",
"pg": "8.8.0",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rxjs": "7.2.0",
"typeorm": "0.2.45"
},
"devDependencies": {
"@commitlint/cli": "17.0.2",
"@commitlint/config-conventional": "16.2.1",
"@nestjs/cli": "9.0.0",
"@nestjs/schematics": "9.0.0",
"@nestjs/testing": "9.0.0",
"@types/express": "4.17.13",
"@types/jest": "28.1.4",
"@types/node": "16.0.0",
"@types/supertest": "2.0.11",
"@typescript-eslint/eslint-plugin": "5.0.0",
"@typescript-eslint/parser": "5.0.0",
"eslint": "8.0.1",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"husky": "8.0.1",
"jest": "28.1.2",
"prettier": "2.3.2",
"source-map-support": "0.5.20",
"supertest": "6.1.3",
"ts-jest": "28.0.5",
"ts-loader": "9.2.3",
"ts-node": "10.0.0",
"tsconfig-paths": "4.0.0",
"typescript": "4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
}
17 changes: 17 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Module } from '@nestjs/common';
import { ServiceModule } from './service/service.module';
import { ClientsModule } from './clients/clients.module';
import { ConfigModule } from '@nestjs/config';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { TypeOrmModule } from '@nestjs/typeorm';

@Module({
imports: [
TypeOrmModule.forRoot(),
ConfigModule.forRoot({ isGlobal: true }),
EventEmitterModule.forRoot({ wildcard: true }),
ClientsModule,
ServiceModule,
],
})
export class AppModule {}
9 changes: 9 additions & 0 deletions src/clients/clients.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Module, Global } from '@nestjs/common';
import { EverscaleService } from './everscale.service';

@Global()
@Module({
providers: [EverscaleService],
exports: [EverscaleService],
})
export class ClientsModule {}
Loading

0 comments on commit 35b28f4

Please sign in to comment.