Giter VIP home page Giter VIP logo

veltrends's Introduction

veltrends

English | 한국어

Veltrends is a website where users can explore trending tech news.

URL

Tech Stack

Frontend

  • React
  • TypeScript
  • Remix
  • Styled Components
  • Tanstack Query
  • Sangte

Backend

  • Node.js
  • TypeScript
  • Fastify
  • Prisma
  • PostgreSQL
  • Swagger
  • Typebox
  • Algolia

Infrastructure

  • Terraform
  • AWS

Running on local environment

Backend

  1. Rename .env.sample to .env in packages/veltrends-server directory.
  2. Modify datasource db part in packages/veltrends-server/prisma/schema.client to use SQLite as below
datasource db {
  provider = "sqlite"
  url      = "file:./dev.db"
}

If you want to use PostgreSQL instead of SQLite, run PostgreSQL server with this link, set DATABASE_URL in .env file, and modify datasource db part in schema.prisma as below.

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}
  1. Delete packages/veltrends-server/prisma/migrations directory.
  2. Use yarn install command to install node_modules.
  3. Use yarn prisma migrate dev command to initialize database.
  4. Use yarn prisma generate command to generate Prisma Client.
  5. Use yarn dev command to run server. Server will run on port 8080. Go to http://localhost:8080/ to check if server is running .

API Documentation is available at http://localhost:8080/documentation.

Frontend

Frontend project uses pnpm to install node_modules.

  1. Rename .env.sample to .env in packages/veltrends-client directory.
  2. Use pnpm install command to install node_modules.
  3. Use pnpm dev command to run server. Server will run on port 8788. Go to http://localhost:3000/ to check if server is running.

Bug Report, Feature Request, Questions

veltrends's People

Contributors

velopert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

veltrends's Issues

UseMutationOptionsOf에 대해 질문이 있습니다

안녕하세요 벨로퍼트님.
벨로퍼트님의 리액트쿼리 훅에 대해서 많은 영감을 받아서 적용 중에 있습니다.
그러던 도중에 UseMutationOptionsOf의 Parameters부분에 문제가 생겨서 질문을 올립니다.

마지막 코드에서 () => mutate() 같은 경우 undefined로 되어서 에러가 뜹니다.
그래서 첫번째 코드와 같이 Parameters 부분을 Parameters<TAPI>[0] extends undefined ? void : Parameters<TAPI>[0] 으로 바꿔 주었습니다.
괜찮은 코드일까요?

import { AppError } from '@/lib/error';
import {
  UseInfiniteQueryOptions,
  UseMutationOptions,
  UseQueryOptions,
} from '@tanstack/react-query';

export type UseMutationOptionsOf<TAPI extends (...args: any) => any> =
  UseMutationOptions<
    Awaited<ReturnType<TAPI>>,
    AppError,
    Parameters<TAPI>[0] extends undefined ? void : Parameters<TAPI>[0]
  >;
import type { AuthParams } from '@/lib/types';
import apiClient from './apiClient';

const AuthAPI = {
  logout: async () => {
    const { data } = await apiClient.delete<void>('/auth/logout');
    return data;
  },
};

export default AuthAPI;
import AuthAPI from '@/lib/api/auth';
import { useMutation } from '@tanstack/react-query';
import type { UseMutationOptionsOf } from '@/hooks/queries/types';

const useLogout = (
  options: UseMutationOptionsOf<typeof AuthAPI.logout> = {},
) => {
  return useMutation(AuthAPI.logout, options);
};

export default useLogout;
const { mutate } = useLogout({
    onSuccess: () => {
      window.location.href = '/';
    },
  });
<Button size="sm" color="warning" shadow onClick={() => mutate()}>
  로그아웃
</Button>

its simple some authorization issue

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "veltrends", schema "public" at "localhost:5434"

Error: db error: ERROR: permission denied for schema public
0: migration_core::state::ApplyMigrations
at migration-engine/core/src/state.rs:185

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

mobile go to home when there is no previous page

When user visits item directly from external referrer (e.g. Twitter) with mobile device, the back button doesn't work (in webview) or goes back to external page.

Guiding users to homepage will be better.

Tag support

Add a tag input between title and body.
For UX, take reference from youtube studio.

Refresh Token failure when multiple tabs are opened.

Since the token system. uses Refresh Token Rotation, a refresh token can be only used once. If a specific refresh token is used more than twice, following token will be blocked.

Current system uses a TokenRefreshScheduler which refreshes the access token before it expires.

The problem kicks in when multiple tabs are opened. All the opened tabs will eventually refresh the token at the same time, and it will cause the token to be blocked.

Possible solutions that come to my mind are:

  1. Use session storage and somehow allow only one tab to refresh the token.
  2. Disable the token scheduler when user loses focus, and re-enable it when user comes back to the tab. This is not a good solution because token won't refresh while user is away from the tab. To properly implement using this method, browser has to check the token expiration time by making a request to the server and refresh the token accordingly.
  3. Refresh the token only when user faces 401 TokenExpiredError. Then, retry request that caused the error. This is very common solution, but it might lead to another issues (what is there are multiple concurrnet requests?), and the flow will get complicated.

I am going for first solution since it is easier to implement. However, the third solution is also a worth a try. May be I will try it later.

i cant run it locally

i tried using the postgres, and the frontend works like i tried to go to the login page, but in the home page it is showing some api error 500

Dark mode

Dark mode will be implemented after 200+ user.

Extract title on url submit

Create a checkbox that extracts title from link, since the user has to copy the title unless they are not translating it.

Setting default value of checkbox to true will be nice. Save the settings to localStorage for better UX.

Upcoming tasks

Features

  • Body should be optional
  • Use Cloudflare R2 for images
  • Add My news page: lists news that a specific user has submitted or liked
  • Allow markdown in comments
  • Notifications on comment
  • Use popeer menu for comment modify/delete on desktop

Bug Fixes

Enhancements

  • Test code for frontend
  • Test code for backend
  • Complete GitHub actions for ECS worker

Login Status not applied on first visit after accessToken expired

When user visits after accessToken expired, the login status is not applied to fetch result of home data. To be specific, like & bookmarks are not applied on first render. When user refreshes, login status is then applied.

This happens cause loader of homepage does not wait until token gets refreshed. Every loaders that gives different result based on login status should be patched.

It is really kind of annoying that there is no definite guide for properly setting cookie for every request. I think using createEventHandler might be a solution.. I will give a try later on.

"과거" 탭 작동 안함

현재 과거탭으로 가면,

모바일

데스크탑

위 사진과 같이 리스트가 비어있다고 뜹니다.
하지만, 다음주 버튼을 눌렀다가 다시 돌아오면, 정상적으로 화면이 표시됩니다.
예시

기본적으로 과거 탭이 잘 작동하게 버그를 고쳐주세요.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.