Coder Social home page Coder Social logo

awork-code-challenge's Introduction

Awork Code Challenge

This is the code demo for awork, you can find the live example here:

https://awork-code-challenge.vercel.app/

image

Installation

This repository uses Bun for installation & running, but npm/yarn should work as well

bun install
bun run dev

or

npm install
npm run dev

If the system uses Nix the setup can be automatically installed via the nix repl

nix develop
# or if direnv is installed
direnv allow

This will automatically install packages like bun, typescript-lsp, etc.

Documentation

Api Key

The api key is stored in the env file as VITE_OMDBAPI_KEY, in a production enviroment this would not be commited, to prevent leaking of any API keys.

Styling

I've opted for tailwind class names for the styling, as it's the quickest way to bootstrap such an application.

API library

I've used Zod library in this repository for the data schema validation, which was not a requirement but it's almost for free code wise and makes your types much easier to reason about.

Testing the API

You can test the API via a REPL without having to interact with the ui like this:

bun repl

In this repl insert the following lines:

import { fetchMoviesByQuery, fetchMovieById } from './src/components/movies/lib.ts';

To search movies:

fetchMoviesByQuery("Blues Brothers").then(console.log)

To show movie details:

fetchMovieById('tt0482521').then(console.log)

Notes

Things I would improve:

  • Use a routing library, but as routing wasn't required I've opted not to use it for the sake of simplicity
  • Use fetching library instead of doing a custom rolled solution using the cancellable Promise
  • Add tests
  • More user-friendly errors
  • Data caching
  • Build out design system & colors

awork-code-challenge's People

Contributors

floscr avatar

Watchers

 avatar Marcelo Tedeschi avatar Santiago Fermín avatar

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.