I am trying to bundle together a couple of games on my own website. I would love to have an interface like Lichess's analysis page:

enter image description here

You can turn on the Stockfish engine, try out different moves and then save it.

Since everything is written in Javascript and HTML, I tried downloading the complete HTML of Lichess's analysis page. Opening the saved page again shows missing board background, Stockfish not working, buttons not showing up. I just can't get it to work. I know Lichess uses chessground.js for their layout engine but that is even more obscure with hardly any examples that show how to even display a full pgn. Does anyone know where I can get a Lichess-analysis-page quality package to display some PGNs while allowing for move exploration and Stockfish integration?

My guess is that just saving the HTML, Javascript, etc. didn't work because the Lichess site also has a server component. If you want to go down that road (which seems like a lot of work!), Lichess is open source; see https://github.com/ornicar/lila .

But maybe you could let lichess.org do the hard work and embed the Lichess view of the games in your website. That is supported: see "Embed a chess analysis in your site" and "Embed a chess game in your site" at https://lichess.org/developers . Unfortunately, I don't think it supports Stockfish and analysis within the embedded widget itself, but it does have a link to go to the full version on lichess.org.

I was able to scrap the Lichess analysis page into independent components, and then recycled the Javascript code for other use.

Unfortunately, it was not simple. You will need to be a competent programmer, able to read HTML/avaScript code say on Google Chrome debugger. The process took me a week of hard works to compete.

I'm not aware of any easy way to achieve what you want to do. Saving a page certainly won't work. Good news to you is that the source code for lichess is open, I recommend you take it a look on Github.

My recommendation is that unless you have strong incentive for the efforts, why not just put a Lichess link on your website?

  • I have looked into ChessGround, the underlying layout engine of Lichess. That is written in TypeScript that is then compiled into JS. I am familiar with a few languages but Javascript and its derivatives aren't among them. JS seems to positively delight in making things obscure. Unless you are willing to share your efforts, I might have to dive right in. I have been tweaking PgnViewerJS which is also based on ChessGround. PgnViewerJS is very readable but the development is nowhere as matured as Lichess. – Spinor8 Aug 10 at 10:46

If you embed your game with frame tag you won't be able to interact with stockfish. If you want stockfish working at your website you should run it from your server, despite the deep calcles can be done at client-size.

I don't know if it will be too much complex, but stockfish is also an open project and you can download the code and try to host it connected with any chess game free program. Then at your site you could try to write your own nice features as lichess team does, and offer them to your clients. Lichess code is open and you can use their code to figure out how to do it.

Alternatively if you only wish to show your analysed games at the site you can use lichess api You migth be able to export all your games you have analysed with the query parameters evals and analysed. You won't have stockfish running but the data of the analysis you did at the site.

  • According to this page, lichess.org/qa/5378/…, the engine is running on client side. That's kind of the point why I am adopting the Lichess analysis page approach. – Spinor8 Aug 10 at 12:43
  • It is true they use client-size for some of the analysis with the engine @Spinor8, but that's not to crash their .org servers. At your webpage, no sense not to run it on the server size if you gonna embed the engine. Anyhow, to run it on your website -at client-size too- you would need to have stockfish code anywhere on your server. For this lichess code can helps you, or you can search for info directly at stockfish also open project and searrch for any open chess game on javascript or so to connect with the engine. – user16971 Aug 10 at 13:20
  • it don't works because stockfish code is probably at their servers @Spinor8, typescript can run server size too. They cannot give you free access to their servers. – user16971 Aug 10 at 13:29
  • I don't really want my server to do the analysing for visitors. Hence, client-side is a must for me. – Spinor8 Aug 10 at 13:48
  • But you must have the code on your server @Spinor8 github.com/official-stockfish/Stockfish Lichess team has probably adapted it and you don't see that at chessground.js file isn't it? – user16971 Aug 10 at 13:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.