Git Product home page Git Product logo

koyo's Introduction

koyo CI/CD

koyo is a web application development toolkit that expands upon Racket's built-in web-server with all the functionality that a web app typically needs in a complete package.

All of koyo's components are decoupled so you get to pick and choose what you use.

Quickstart

$ raco pkg install koyo
$ raco koyo new example  # or raco koyo new -b minimal example
$ cd example && cat README.md

Documentation

You can find the documentation on the Racket package server. The package server only updates once every few hours so if you want the absolute most recent docs, then you can visit koyoweb.org.

License

koyo is licensed under the 3-Clause BSD license.

koyo's People

Contributors

bogdanp avatar gknauth avatar ilnarselimcan avatar jessealama avatar ret avatar sxn avatar zkry 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

koyo's Issues

Question: dev workflow?

Hey Bogdan.

As I've been playing with koyo I found myself at odds with the usual way I'd write Racket code. What's the dev workflow story for koyo powered apps? I suppose this is a "function" or "compiler" vs long-running process or service development question, for which Racket approach of always restarting execution afresh feels kinda icky. If you are using Emacs with racket-mode then perhaps you find yourself in the same boat and maybe settled on a nice enough workflow?

Koyo of course takes it further than even DrRacket or racket-mode - it watches the filesystem and recompiles and restarts everything. That makes REPL pretty much redundant. Delays introduced by such recompilations and restarts are significant enough to make it annoying - computers are after all quite fast but perhaps Racket expander is still not fast enough. Where does REPL powered dev cycle fit here? How do you approach programming new "components" or adding or changing functionality of the existing ones? Adding new modules etc.

Thank you

P.S.: Also briefly touched that in greghendershott/racket-mode#472 (comment)

`haml` cannot use unquote-splicing at the root level

Given (define items (haml (:li "a") (:li "b"))), either of the below result in an error:

(haml ,@items)
(haml (:li "First") ,@items)
../../../Library/Racket/snapshot/pkgs/koyo-lib/koyo/haml.rkt:193:28: 
unquote-splicing: invalid context within quasiquote in: (unquote-splicing items)

Using with sqlite?

Hi! I tried to use koyo with sqlite, but it gave me an error saying that I needed to provide a DB port. However, that doesn't make much sense with sqlite.

The database module documentation seems to indicate that it should be possible, so I'm guessing I missed something?

argon2id-hasher: unhandled error: illegal instruction. Some debugging context lost

Hello, I just wanted to take a look to this project and I got this error trying to sign up

I am using argon2 20190702-3 from the archlinux repositories and racket 8.2 CS
I have no idea how to debug this, what instruction is illegal?
but is it using the argon2 shared library from the os? (yes, it uses Places https://docs.racket-lang.org/reference/places.html)

Anyway, I see that argon should be one of the hasher available https://koyoweb.org/password-hashing/index.html
Is there a wishlist of other hasher?
maybe a pure racket implementation should be the perfect fallback, I see that https://pkgs.racket-lang.org/package/crypto-lib have various kdf implementations, such as argon2id, so if the koyo user will set the same parameters of the current implementation there will be no need for a rehashing migration

but does crypto-lib use the shared library from the os?

these are the default parameters, but can be configured, (where? I dont't see them in koyo/config and in proj/config, oh, ok, dynamic.rkt oh wow #:user config:db-username is beautiful there)

;; ;; ;; from koyo/hasher/argon2id.rkt
                   #:parallelism [parallelism (processor-count)]
                   #:iterations [iterations 256]
                   #:memory [memory 2048]))
;; ;; ;; ;; ;; ;; overwritten by the configuration in dynamic.rkt to use always only 2 (threads?)
 [hasher (make-argon2id-hasher-factory
           #:parallelism 2
           #:iterations 256
           #:memory 2048)]

hey but wait, in koyo/hasher/argon2id-place.rkt there is crypto/argon2 required!
how is it used? why it uses places then?
it uses pwhash and pwhash-verify, but why are them tied to a place channel? is it a security measure? spawning a new racket VM just for that? it's the same process anyway. I can't profile it right now, it waits undefinitely and no answer is given to the client
uhm...
so, (exn-message e) is illegal instruction. Some debugging context lost
oh, now I got what illegal instruction is related to, it means at hardware level, it's a racket bug!?
ok, what can I do now? should I use valgrind? I don't see any output after the server starts and after the place starts it hangs (launched with valgrind raco chief start i see memcheck and then the server logs)
there are no issues with memory then I suppose
what am I trying to fix then?

by looking at similar issues in the racket github, only two of them seem related (but now even so close) to this and are tagged as 'unexplained

is it debuggable with gdb? what's gdbdump racket package? is there a debug helper for such situations? I'm pretty stuck now

;; lscpu
Architecture:           x86_64
  CPU op-mode(s):       32-bit, 64-bit
  Address sizes:        36 bits physical, 48 bits virtual
  Byte Order:           Little Endian
CPU(s):                 4
  Model name:           Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz

Thank you for reading

403 Forbidden on use of continuations in example app

Hello,
I have a problem that I was encountering when setting up the example page. I was following the getting started README and got the starter app up and running. The pages were all working but any time I submitted a form, it would return a 403 Forbidden error (signup;((%22k%22%20.%20%22(81%201%2014653598)%22)):1 Failed to load resource: the server responded with a status of 403 (Forbidden))

This seems like it should be easy to fix but being new to Racket I'm not sure how to debug this.

locale file not reloading

I'm just trying out the example app generated with raco koyo new. It seems that triggering reloading by modifying the translation file (e.g. in the example app resources/locales/en/us.rktd) isn't enough, I need to stop the server and restart.

Are rktd files not a subject to reloading that's discussed here?

Example app?

Is there an example app somewhere that uses Koyo? The docs are looking thorough, but I'd love to poke around in some source code.

Fix some minor linting issues identified by the GitHub Super Linter

The GitHub Super-Linter is a bundle of linting tools. It has identified some minor problems with a few of the static assets that come with an out-of-the-box koyo starter project created by raco koyo new example.

  • resources/css/_colors.scss
  3:15  ✖  Expected "#1F2933" to be "#1f2933"   color-hex-case
  4:15  ✖  Expected "#323F4B" to be "#323f4b"   color-hex-case
  5:15  ✖  Expected "#3E4C59" to be "#3e4c59"   color-hex-case
  6:15  ✖  Expected "#52606D" to be "#52606d"   color-hex-case
  7:15  ✖  Expected "#616E7C" to be "#616e7c"   color-hex-case
  8:15  ✖  Expected "#7B8794" to be "#7b8794"   color-hex-case
  9:15  ✖  Expected "#9AA5B1" to be "#9aa5b1"   color-hex-case
 10:15  ✖  Expected "#CBD2D9" to be "#cbd2d9"   color-hex-case
 11:15  ✖  Expected "#E4E7EB" to be "#e4e7eb"   color-hex-case
 12:15  ✖  Expected "#F5F7FA" to be "#f5f7fa"   color-hex-case
  • resources/css/_uprofiler.scss
20:16  ✖  Unexpected missing generic font family                                                                                                            font-family-no-missing-generic-family-keyword
  42:16  ✖  Unexpected missing generic font family                                                                                                            font-family-no-missing-generic-family-keyword
  67:6   ✖  Expected double colon pseudo-element notation                                                                                                     selector-pseudo-element-colon-notation       
  89:18  ✖  Unexpected missing generic font family                                                                                                            font-family-no-missing-generic-family-keyword
 105:27  ✖  Expected double colon pseudo-element notation                                                                                                     selector-pseudo-element-colon-notation       
 114:1   ✖  Expected selector ".uprofiler-timings-inner > .uprofiler-timing" to come before selector ".uprofiler-timing-toggle:checked ~ .uprofiler-timing"   no-descending-specificity                    
 123:1   ✖  Unexpected empty line before closing brace                                                                                                        block-closing-brace-empty-line-before
  • resources/css/screen.scss
  98:5   ✖  Unexpected empty line before declaration                                                    declaration-empty-line-before
 111:19  ✖  Unexpected unit                                                                             length-zero-no-unit          
 124:5   ✖  Unexpected empty line before declaration                                                    declaration-empty-line-before
 141:5   ✖  Expected selector ".form__group input" to come before selector ".form__group label input"   no-descending-specificity
  • Brocfile.js:2:28

Several suggestions coming from standardjs.

  • .env.example

Complaint about the lexicographic order of the environment variables: FOO_LOG_LEVEL should come before FOO_PROFILE.

  • README.md

Even the Markdown got linted (!).

README.md:15:5 MD014/commands-show-output Dollar signs used before commands without showing output [Context: "$ nvm use && npm install && np..."]

(repeated a few times, once each for the commands mentioned)

  • A few other files were flagged by Super-Linter (for example, resources/vendor/unpoly.min.css), but they are in vendor-supplied CSS/JS, so I guess we need to live with them.

Issue with getting started

I just discovered Koyo and figured I'd start by following the video here. After running through the setup steps, starting Koyo results in a contract violation:

14:16:34 web.1    | [2024-03-02 14:16:34.334] [   48377] [   info] runner: compiling application
14:16:35 web.1    |  9 making /Users/dev/Repos/shorty/shorty/dynamic.rkt
14:16:35 web.1    |  9 made /Users/dev/Repos/shorty/shorty/dynamic.rkt
14:16:35 web.1    | [2024-03-02 14:16:35.584] [   48377] [   info] runner: starting application process
14:16:35 web.1    | dynamic-rerequire: contract violation
14:16:35 web.1    |   expected: module-path?
14:16:35 web.1    |   given: "/Users/dev/Repos/shorty/shorty/dynamic.rkt"
14:16:35 web.1    |   context...:
14:16:35 web.1    |    /Users/dev/Library/Racket/8.12/pkgs/koyo-lib/koyo/runner.rkt:185:4
14:16:35 web.1    |    /Users/dev/Library/Racket/8.12/pkgs/koyo-lib/koyo/runner.rkt:200:2: loop
14:16:35 web.1    |    body of (submod "/Users/dev/Library/Racket/8.12/pkgs/koyo-lib/koyo/runner.rkt" main)
14:16:35 web.1    | [2024-03-02 14:16:35.725] [   48377] [   info] runner: application process started with pid 48425
14:16:35 web.1    | [2024-03-02 14:16:35.725] [   48377] [warning] runner: application process failed; waiting for changes before reloading

Any ideas what the issue could be? Any help is much appreciated.

Verification link sent on signup does not work when clicked, only when pasted

Today I had someone try to sign up on my webpage and clicking the link (in Chrome, on Windows) didn't work to get them to verify their email address. They had to open an incognito Window and paste in the link - although it may be that the incognito part was only necessary because the first click let to the page getting cached, and then copy-pasting not helping to get the actual webpage.

This seems like the same issue as should have been addressed by commit 763da86. I checked and the code is updated accordingly in dynamic.rkt. Another user told me that they had gotten the same error, with a page showing forbidden popping up (that may have happened at another time, so it may not be related).

The link HTML in the email (replacing website-url and secret key) is:

<a class=3D"button button--" style=3D"color: #FFF; background-color: #3869D4; border-top: 10px solid #3869D4; border-right: 18px solid #3869D4; border-bottom: 10px solid #3869D4; border-left:18px solid #3869D4; display: inline-block; text-decoration: none;border-radius: 3px; box-shadow: 0 2px 3px rgba(0,0,0,0.16); -webkit-text-size-adjust: none; box-sizing: border-box;" href=3D"https:///verify/7/" target=3D"_blank">Verify your email

I see nothing funky here, so I guess something is misconfigured on the server.

One possibility is that the live server isn't using the most recent code - but I'm using GitHub actions with your Racket action, so I don't think that's the case.

'raco koyo console' does not work.

when type 'raco koyo console', no module is loaded in to scope.

image

I was able to follow the video tutorial all of the content except this development repl through 'raco koyo console'.

Not sure what I have missed.

Thanks

Break koyo/mime module into own package?

Hey Bogdan, I've been playing a bit with web servers in racket. Much to my surprise, there wasn't an utility procedure to lookup mime types shipped with web-server-lib (to the best of my knowledge). Did some research and found koyo ships with a mime lookup module (koyo/mime). I have a feeling many users using web-server may want to utilize this module in particular.

Would it make sense to break it out into its own package? This would eliminate some present gotchas, such as 97jaz/gregor#51 through stripping out most dependencies that koyo depends on.

What do you think?

Thanks,
Winny

`generate-random-string` does not allow odd-length strings

Koyo's generate-random-string does not allow one to generate an odd-length string. Example:

$ racket
Welcome to Racket v8.3 [cs].
> (require koyo/random)
> (generate-random-string 4)
"e498"
> (generate-random-string 3)
; crypto-random-bytes: contract violation
;   expected: natural?
;   given: 3/2
;   in: the 1st argument of
;       (-> natural? bytes?)
;   contract from: <collects>/racket/random.rkt
;   blaming: <pkgs>/koyo-lib/koyo/random.rkt
;    (assuming the contract is correct)
;   at: <collects>/racket/random.rkt:5:24

It seems unintentional that odd-length strings would be unsupported.

Hasher fails to find 'argon2id' implementation

Hi Bogdan.

Getting this atm with current master. I wonder if your libargon2 package actually installs the libargon2.dylib. Not quite sure how to check.

16:56:39 web.1    | [2020-05-07 16:56:39] [   96161] [  error] hasher: unhandled error: pwhash: could not get implementation
16:56:39 web.1    |   KDF: 'argon2id

Above comes from the Racket crypto lib but is being reported by your logger. Steps to reproduce:

  • fresh install koyo I did raco pkg intsall -u --clone koyo so its linked and is using current master,
  • go through install steps as described in the generated README.md,
  • try to register a user via the signup page

[Question] Multi-context web application

Hello,

Could you please provide a working example where under one app instance of koyo, one is able to have lots of dispatch rules, separated per context? Maybe a stripped-down version of the e-commerce you've built with koyo?

I am trying to see if I can use this framework to replace the Magento 2 nonsense, I've figured out few things already thanks to the power of Racket, and the nice things you provide with it but the (forward/backward) routing still remains obscure to me.

As of now the only way I see working is to litter the app.rkt file with let's say hundreds of dispatch rules under the same definition, with no clear distinction of context, other than the URL and the responder's name.

Is there a nice way to do some sort of sub-routing without messing with the syntax rules of dispatch-rules+roles ?

Plus some extra documentation on the koyo components over all would be nice. Some components are in dire need of some extra documentation and/or usage

Thanks in advance

koyo/haml multiple html attributes issue

For example:

(haml
  (.c1.c2
    ([:class "c3"]
     [:class "c4"])))

there will produce:

'(div ((class "c1 c2") (class "c3") (class "c4")))

but browser don't support these format. browser automatically remove others same attributes, not only class attributes.

BrowserSync + koyo = resources + racket livereload <3

Hello,

Starting from a sample koyo app, I quickly faced the fact that broccoli-sass is a bit old and thus can't work on my node.js installation (I'm at v12.3.1), so I decided to see if I could replace the broccoli pipeline by a more modern gulp.

This worked well. Then I realized that your nice Racket reloading code was pretty nice and efficient (although I got bit because translations changes do not trigger reloads) so I added Browsersync proxy-ing and live-reloading to the whole thing.

The result is testable at https://github.com/octplane/koyo-sample-browsersync and is a simple Koyo app with all this enabled:

  • gulp -T will show the available tasks: not sure what should be kept and what should be thrown away
  • I've updated the Procfile.dev to run the gulp serve task instead of the Broccoli code
  • Browsersync also serves the static assets directly, it's probably faster than going through the Racket stack
  • I've added a plop (poor naming) function in dynamic.rkt that is called through the server instanciation: this call browsersync and asks for a reload.

This way, the page gets automatically reloaded:

  • whenever a change is done in resources (and gulp rebuilds the assets and reload the page)
  • whenever the racket watcher decides to restart the server

The only annoying thing is that Browsersync opens the browser way too early and you have to reload the page once the Koyo app has started.

I believe this is a nice improvement to the standard koyo app and if you want, I'd happy to try and provide a PR to the blueprint so that this works out of the box for development. For production, the reloading hook should probably be removed. I confess I did not look at the way koyo packages the app for production.

Let me know what you think of that!

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.